🐛 Trying to fix list post v2 didn't get the data
This commit is contained in:
		| @@ -30,6 +30,6 @@ type Publisher struct { | ||||
| 	RealmID   *uint `json:"realm_id"` | ||||
| 	AccountID *uint `json:"account_id"` | ||||
|  | ||||
| 	Account models.Account `gorm:"-"` | ||||
| 	Realm   models.Realm   `gorm:"-"` | ||||
| 	Account models.Account `gorm:"-" json:"realm"` | ||||
| 	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 | ||||
| 	for _, item := range posts { | ||||
| 	for idx, item := range posts { | ||||
| 		var this []fmodels.Attachment | ||||
| 		if val, ok := item.Body["attachments"].([]string); ok && len(val) > 0 { | ||||
| 			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 | ||||
| 		}) | ||||
| 		posts[idx] = item | ||||
| 	} | ||||
|  | ||||
| 	// Add post views for the user | ||||
|   | ||||
		Reference in New Issue
	
	Block a user