diff --git a/ui/src/components/main.tsx b/ui/src/components/main.tsx index 87a2fb66b..816120096 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 8dbe1f48f..3e6e17eb3 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) {