]> Untitled Git - lemmy.git/blobdiff - crates/db_views/src/comment_view.rs
Allow filtering out of deleted and removed comments when getting person details ...
[lemmy.git] / crates / db_views / src / comment_view.rs
index 2b496b4ebb8c86ee3e538f8df8bc25cf39124b18..0efc4e11f17a0a0d86ec9b9ac9dc505582b63432 100644 (file)
@@ -165,6 +165,7 @@ pub struct CommentQuery<'a> {
   local_user: Option<&'a LocalUser>,
   search_term: Option<String>,
   saved_only: Option<bool>,
+  show_deleted_and_removed: Option<bool>,
   page: Option<i64>,
   limit: Option<i64>,
   max_depth: Option<i32>,
@@ -302,6 +303,11 @@ impl<'a> CommentQuery<'a> {
       query = query.filter(comment_saved::id.is_not_null());
     }
 
+    if !self.show_deleted_and_removed.unwrap_or(true) {
+      query = query.filter(comment::deleted.eq(false));
+      query = query.filter(comment::removed.eq(false));
+    }
+
     if !self.local_user.map(|l| l.show_bot_accounts).unwrap_or(true) {
       query = query.filter(person::bot_account.eq(false));
     };