summaryrefslogtreecommitdiffstats
path: root/ui/src/components/main.tsx
diff options
context:
space:
mode:
authorDessalines <tyhou13@gmx.com>2020-02-27 16:24:27 -0500
committerDessalines <tyhou13@gmx.com>2020-02-27 16:24:27 -0500
commit3d649756eca377d20de0c47c9cc50d0d76d4b4ba (patch)
tree5f99858af23b8c7debb48e019c53668ab21d75fa /ui/src/components/main.tsx
parenteead117d6b54298f86daa161be752096113fa1a7 (diff)
New nsfw posts.
Diffstat (limited to 'ui/src/components/main.tsx')
-rw-r--r--ui/src/components/main.tsx16
1 files changed, 13 insertions, 3 deletions
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<any, MainState> {
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);