From: Dessalines Date: Thu, 27 Feb 2020 21:24:27 +0000 (-0500) Subject: New nsfw posts. X-Git-Url: http://these/git/%22https:/image.com/%7BcommunityRSSUrl%28?a=commitdiff_plain;h=3d649756eca377d20de0c47c9cc50d0d76d4b4ba;p=lemmy.git New nsfw posts. --- diff --git a/ui/src/components/main.tsx b/ui/src/components/main.tsx index 87a2fb66..81612009 100644 --- a/ui/src/components/main.tsx +++ b/ui/src/components/main.tsx @@ -626,10 +626,20 @@ export class Main extends Component { this.state.posts.unshift(data.post); } } else { - this.state.posts.unshift(data.post); - } + // NSFW posts + let nsfw = data.post.nsfw || data.post.community_nsfw; - this.setState(this.state); + // Don't push the post if its nsfw, and don't have that setting on + if ( + !nsfw || + (nsfw && + UserService.Instance.user && + UserService.Instance.user.show_nsfw) + ) { + this.state.posts.unshift(data.post); + this.setState(this.state); + } + } } else if (res.op == UserOperation.EditPost) { let data = res.data as PostResponse; editPostFindRes(data, this.state.posts); diff --git a/ui/src/components/post-listing.tsx b/ui/src/components/post-listing.tsx index 8dbe1f48..3e6e17eb 100644 --- a/ui/src/components/post-listing.tsx +++ b/ui/src/components/post-listing.tsx @@ -846,7 +846,6 @@ export class PostListing extends Component { } else { this.state.thumbnail = null; } - this.setState(this.state); } handlePostLike(i: PostListing) {