From 3d649756eca377d20de0c47c9cc50d0d76d4b4ba Mon Sep 17 00:00:00 2001 From: Dessalines Date: Thu, 27 Feb 2020 16:24:27 -0500 Subject: New nsfw posts. --- ui/src/components/main.tsx | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'ui/src/components/main.tsx') 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); -- cgit v1.2.3