🐛 Fix posts filter with user context filtered all the posts

This commit is contained in:
LittleSheep 2024-12-11 23:05:31 +08:00
parent 25eb0585d5
commit 79a61cc732

View File

@ -132,7 +132,9 @@ func FilterPostWithUserContext(tx *gorm.DB, user *authm.Account) *gorm.DB {
datatypes.JSONQuery("invisible_users").HasKey(strconv.Itoa(int(user.ID))), datatypes.JSONQuery("invisible_users").HasKey(strconv.Itoa(int(user.ID))),
) )
tx = tx.Where("publisher_id NOT IN ?", invisibleList) if len(invisibleList) > 0 {
tx = tx.Where("publisher_id NOT IN ?", invisibleList)
}
return tx return tx
} }