]> Untitled Git - lemmy.git/commitdiff
Fix saved posts and hide read posts issue. Fixes #1839 (#1840)
authorDessalines <dessalines@users.noreply.github.com>
Thu, 14 Oct 2021 17:03:12 +0000 (13:03 -0400)
committerGitHub <noreply@github.com>
Thu, 14 Oct 2021 17:03:12 +0000 (17:03 +0000)
crates/db_views/src/post_view.rs

index ec537ad9471298b62637afcd8b875243bd5183f3..dc55e6ece4f6170145ea8b590c03e5e35f84ef3f 100644 (file)
@@ -399,13 +399,14 @@ impl<'a> PostQueryBuilder<'a> {
       query = query.filter(person::bot_account.eq(false));
     };
 
-    if !self.show_read_posts.unwrap_or(true) {
-      query = query.filter(post_read::id.is_null());
-    };
-
     if self.saved_only.unwrap_or(false) {
       query = query.filter(post_saved::id.is_not_null());
-    };
+    }
+    // Only hide the read posts, if the saved_only is false. Otherwise ppl with the hide_read
+    // setting wont be able to see saved posts.
+    else if !self.show_read_posts.unwrap_or(true) {
+      query = query.filter(post_read::id.is_null());
+    }
 
     // Don't show blocked communities or persons
     if self.my_person_id.is_some() {