🐛 Trying to fix list post v2 didn't get the data
This commit is contained in:
parent
b2466bdee1
commit
9fe0962c4a
@ -30,6 +30,6 @@ type Publisher struct {
|
|||||||
RealmID *uint `json:"realm_id"`
|
RealmID *uint `json:"realm_id"`
|
||||||
AccountID *uint `json:"account_id"`
|
AccountID *uint `json:"account_id"`
|
||||||
|
|
||||||
Account models.Account `gorm:"-"`
|
Account models.Account `gorm:"-" json:"realm"`
|
||||||
Realm models.Realm `gorm:"-"`
|
Realm models.Realm `gorm:"-" json:"realm"`
|
||||||
}
|
}
|
||||||
|
@ -111,7 +111,7 @@ func ListPostV2(tx *gorm.DB, take int, offset int, order any, user *uint) ([]mod
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Putting information back to data
|
// Putting information back to data
|
||||||
for _, item := range posts {
|
for idx, item := range posts {
|
||||||
var this []fmodels.Attachment
|
var this []fmodels.Attachment
|
||||||
if val, ok := item.Body["attachments"].([]string); ok && len(val) > 0 {
|
if val, ok := item.Body["attachments"].([]string); ok && len(val) > 0 {
|
||||||
this = lo.Filter(attachments, func(item fmodels.Attachment, _ int) bool {
|
this = lo.Filter(attachments, func(item fmodels.Attachment, _ int) bool {
|
||||||
@ -125,6 +125,7 @@ func ListPostV2(tx *gorm.DB, take int, offset int, order any, user *uint) ([]mod
|
|||||||
}
|
}
|
||||||
return acc.ID == *item.Publisher.AccountID
|
return acc.ID == *item.Publisher.AccountID
|
||||||
})
|
})
|
||||||
|
posts[idx] = item
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add post views for the user
|
// Add post views for the user
|
||||||
|
Loading…
x
Reference in New Issue
Block a user