From: Dessalines <dessalines@users.noreply.github.com>
Date: Wed, 26 May 2021 18:02:35 +0000 (-0400)
Subject: Fix nsfw posts showing for non-logged in users. Fixes #1614 (#1615)
X-Git-Url: http://these/git/%7B%60https:/%22https:/lemmy.ml/u/Liwott/%22?a=commitdiff_plain;h=b95bbe2fae4c0bb2f6d7bb5682d52149b258b239;p=lemmy.git

Fix nsfw posts showing for non-logged in users. Fixes #1614 (#1615)
---

diff --git a/crates/db_views/src/post_view.rs b/crates/db_views/src/post_view.rs
index 1d8ea80e..d0f46dad 100644
--- a/crates/db_views/src/post_view.rs
+++ b/crates/db_views/src/post_view.rs
@@ -359,7 +359,7 @@ impl<'a> PostQueryBuilder<'a> {
       query = query.filter(post::creator_id.eq(creator_id));
     }
 
-    if !self.show_nsfw.unwrap_or(true) {
+    if !self.show_nsfw.unwrap_or(false) {
       query = query
         .filter(post::nsfw.eq(false))
         .filter(community::nsfw.eq(false));
diff --git a/crates/db_views_actor/src/community_view.rs b/crates/db_views_actor/src/community_view.rs
index 63e52941..fc582857 100644
--- a/crates/db_views_actor/src/community_view.rs
+++ b/crates/db_views_actor/src/community_view.rs
@@ -198,7 +198,7 @@ impl<'a> CommunityQueryBuilder<'a> {
       }
     };
 
-    if !self.show_nsfw.unwrap_or(true) {
+    if !self.show_nsfw.unwrap_or(false) {
       query = query.filter(community::nsfw.eq(false));
     };