]> Untitled Git - lemmy-ui.git/blobdiff - src/shared/components/post/post.tsx
Feature/user community block (#362)
[lemmy-ui.git] / src / shared / components / post / post.tsx
index 58f1ae13a5ca43aa1cc3f13f5c8aa9c20ee63235..3186242a970c58fa7705822f8874fdc24bb9459f 100644 (file)
@@ -5,6 +5,7 @@ import {
   AddModToCommunityResponse,
   BanFromCommunityResponse,
   BanPersonResponse,
+  BlockPersonResponse,
   CommentResponse,
   CommunityResponse,
   GetCommunityResponse,
@@ -50,6 +51,7 @@ import {
   setOptionalAuth,
   setupTippy,
   toast,
+  updatePersonBlock,
   wsClient,
   wsJsonToRes,
   wsSubscribe,
@@ -237,8 +239,9 @@ export class Post extends Component<any, PostState> {
       : this.state.postRes.post_view.creator.id;
 
     if (
-      UserService.Instance.localUserView &&
-      UserService.Instance.localUserView.person.id == parent_person_id
+      UserService.Instance.myUserInfo &&
+      UserService.Instance.myUserInfo.local_user_view.person.id ==
+        parent_person_id
     ) {
       let form: MarkCommentAsRead = {
         comment_id: found.comment.id,
@@ -617,6 +620,9 @@ export class Post extends Component<any, PostState> {
       this.state.postRes.post_view.community = data.community_view.community;
       this.state.postRes.moderators = data.moderators;
       this.setState(this.state);
+    } else if (op == UserOperation.BlockPerson) {
+      let data = wsJsonToRes<BlockPersonResponse>(msg).data;
+      updatePersonBlock(data);
     }
   }
 }