Fix deleted posts so they can only be seen by creator (#4182)

This commit is contained in:
Nutomic 2023-11-21 14:59:47 +01:00 committed by GitHub
parent 30f7135f32
commit 49377c195e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -296,12 +296,14 @@ fn queries<'a>() -> Queries<
options.saved_only,
);
let is_creator = options.creator_id == options.local_user.map(|l| l.person.id);
// hide posts from deleted communities
query = query.filter(community::deleted.eq(false));
// only show deleted posts to creator
if is_creator {
query = query
.filter(community::deleted.eq(false))
.filter(post::deleted.eq(false));
if let Some(person_id) = person_id {
query = query.filter(post::deleted.eq(false).or(post::creator_id.eq(person_id)));
} else {
query = query.filter(post::deleted.eq(false));
}
let is_admin = options