From 81c99119651d1221be0f2ccbf54e3c9ef9f3efe5 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Fri, 6 Dec 2019 22:43:20 -0800 Subject: [PATCH] Show removed posts in users history. - Fixes #354 --- server/src/db/post_view.rs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/server/src/db/post_view.rs b/server/src/db/post_view.rs index 51dea027f..e4e3c16d0 100644 --- a/server/src/db/post_view.rs +++ b/server/src/db/post_view.rs @@ -95,8 +95,15 @@ impl PostView { let mut query = post_view.into_boxed(); + // If its for a specific user, show the removed / deleted if let Some(for_creator_id) = for_creator_id { query = query.filter(creator_id.eq(for_creator_id)); + } else { + query = query + .filter(removed.eq(false)) + .filter(deleted.eq(false)) + .filter(community_removed.eq(false)) + .filter(community_deleted.eq(false)); }; if let Some(search_term) = search_term { @@ -161,13 +168,7 @@ impl PostView { .then_order_by(score.desc()), }; - query = query - .limit(limit) - .offset(offset) - .filter(removed.eq(false)) - .filter(deleted.eq(false)) - .filter(community_removed.eq(false)) - .filter(community_deleted.eq(false)); + query = query.limit(limit).offset(offset); query.load::(conn) }