🐛 Fix visibility filter
This commit is contained in:
parent
fca4032031
commit
8aa627ef43
@ -27,10 +27,16 @@ func FilterPostWithUserContext(tx *gorm.DB, user *models.Account) *gorm.DB {
|
||||
)
|
||||
|
||||
// TODO Blocked by dealer, need support get friend list
|
||||
tx = tx.Where("visibility != ? OR visibility != ?", FriendsVisibility, NoneVisibility).
|
||||
Or("visibility = ? AND ?", SelectedVisibility, datatypes.JSONQuery("visible_users").HasKey(strconv.Itoa(int(user.ID)))).
|
||||
Or("visibility = ? AND NOT ?", SelectedVisibility, datatypes.JSONQuery("invisible_users").HasKey(strconv.Itoa(int(user.ID)))).
|
||||
Or("author_id = ?", user.ID)
|
||||
tx = tx.Where(
|
||||
"(visibility != ? OR visibility != ? OR (visibility = ? AND ?) OR (visibility = ? AND NOT ?) OR author_id = ?)",
|
||||
FriendsVisibility,
|
||||
NoneVisibility,
|
||||
SelectedVisibility,
|
||||
datatypes.JSONQuery("visible_users").HasKey(strconv.Itoa(int(user.ID))),
|
||||
SelectedVisibility,
|
||||
datatypes.JSONQuery("invisible_users").HasKey(strconv.Itoa(int(user.ID))),
|
||||
user.ID,
|
||||
)
|
||||
|
||||
return tx
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user