New nsfw posts.

This commit is contained in:
Dessalines 2020-02-27 16:24:27 -05:00
parent eead117d6b
commit 3d649756ec
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;
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);

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) {