New nsfw posts.

This commit is contained in:
Dessalines 2020-02-27 16:24:27 -05:00
parent fab10ef792
commit b277d92226
2 changed files with 13 additions and 4 deletions

View file

@ -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;
// 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);

View file

@ -846,7 +846,6 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
} else {
this.state.thumbnail = null;
}
this.setState(this.state);
}
handlePostLike(i: PostListing) {