🐛 Fix batch list reactions cannot work properly

This commit is contained in:
2024-07-05 21:06:18 +08:00
parent d7113b5237
commit 0015952f92
5 changed files with 17 additions and 13 deletions

View File

@@ -152,7 +152,7 @@ func ListPost(tx *gorm.DB, take int, offset int, noReact ...bool) ([]*models.Pos
// Load reactions
if len(noReact) <= 0 || !noReact[0] {
if mapping, err := BatchListResourceReactions(database.C.Where("post_id IN ?", idx)); err != nil {
if mapping, err := BatchListResourceReactions(database.C.Where("post_id IN ?", idx), "post_id"); err != nil {
return items, err
} else {
itemMap := lo.SliceToMap(items, func(item *models.Post) (uint, *models.Post) {