mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-29 15:51:14 +00:00
Dont receive post room comments from blocked users. (#516)
This commit is contained in:
parent
e976c45f88
commit
5074165226
1 changed files with 6 additions and 1 deletions
|
@ -551,8 +551,13 @@ export class Post extends Component<any, PostState> {
|
||||||
} else if (op == UserOperation.CreateComment) {
|
} else if (op == UserOperation.CreateComment) {
|
||||||
let data = wsJsonToRes<CommentResponse>(msg).data;
|
let data = wsJsonToRes<CommentResponse>(msg).data;
|
||||||
|
|
||||||
|
// Don't get comments from the post room, if the creator is blocked
|
||||||
|
let creatorBlocked = UserService.Instance.myUserInfo?.person_blocks
|
||||||
|
.map(pb => pb.target.id)
|
||||||
|
.includes(data.comment_view.creator.id);
|
||||||
|
|
||||||
// Necessary since it might be a user reply, which has the recipients, to avoid double
|
// Necessary since it might be a user reply, which has the recipients, to avoid double
|
||||||
if (data.recipient_ids.length == 0) {
|
if (data.recipient_ids.length == 0 && !creatorBlocked) {
|
||||||
this.state.postRes.comments.unshift(data.comment_view);
|
this.state.postRes.comments.unshift(data.comment_view);
|
||||||
insertCommentIntoTree(this.state.commentTree, data.comment_view);
|
insertCommentIntoTree(this.state.commentTree, data.comment_view);
|
||||||
this.state.postRes.post_view.counts.comments++;
|
this.state.postRes.post_view.counts.comments++;
|
||||||
|
|
Loading…
Reference in a new issue