From 49377c195e299d47bb22356e1891ae10fc94f717 Mon Sep 17 00:00:00 2001 From: Nutomic Date: Tue, 21 Nov 2023 14:59:47 +0100 Subject: [PATCH] Fix deleted posts so they can only be seen by creator (#4182) --- crates/db_views/src/post_view.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/crates/db_views/src/post_view.rs b/crates/db_views/src/post_view.rs index 909b8079f..fd9692341 100644 --- a/crates/db_views/src/post_view.rs +++ b/crates/db_views/src/post_view.rs @@ -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