🐛 Fix visibility query type issue
This commit is contained in:
parent
2fe32d6c98
commit
2d66b8acc0
@ -18,10 +18,16 @@ func FilterPostWithUserContext(tx *gorm.DB, user *models.Account) *gorm.DB {
|
|||||||
return tx.Where("visibility = ?", models.PostVisibilityAll)
|
return tx.Where("visibility = ?", models.PostVisibilityAll)
|
||||||
}
|
}
|
||||||
|
|
||||||
tx = tx.Where("visibility != ?", models.PostVisibilityFriends) // TODO Blocked by dealer, need support get friend list
|
// TODO Blocked by dealer, need support get friend list
|
||||||
tx = tx.Where("visibility = ? AND visible_users @> '[?]'", models.PostVisibilitySelected, user.ID)
|
tx = tx.Where(
|
||||||
tx = tx.Where("visibility = ? AND NOT invisible_users @> '[?]'", models.PostVisibilitySelected, user.ID)
|
"visibility != ? OR (visibility = ? AND visible_users @> '[?]'::jsonb) OR (visibility = ? AND NOT invisible_users @> '[?]'::jsonb) OR visibility != ?",
|
||||||
tx = tx.Where("visibility != ?", models.PostVisibilityNone)
|
models.PostVisibilityFriends,
|
||||||
|
models.PostVisibilitySelected,
|
||||||
|
user.ID,
|
||||||
|
models.PostVisibilitySelected,
|
||||||
|
user.ID,
|
||||||
|
models.PostVisibilityNone,
|
||||||
|
)
|
||||||
|
|
||||||
return tx
|
return tx
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user