]> Untitled Git - lemmy-ui.git/blobdiff - src/shared/components/post/post.tsx
Merge branch 'main' into breakout-role-utils
[lemmy-ui.git] / src / shared / components / post / post.tsx
index 9c68532bee5122c816ae12d4a48f12375b7c265e..05e4d9b918fdb116a193b5d4da7592f9347879a1 100644 (file)
@@ -73,7 +73,6 @@ import {
   getCommentParentId,
   getDepthFromComment,
   getIdFromProps,
-  isBrowser,
   isImage,
   myAuth,
   restoreScrollPosition,
@@ -84,6 +83,7 @@ import {
   updateCommunityBlock,
   updatePersonBlock,
 } from "../../utils";
+import { isBrowser } from "../../utils/browser/is-browser";
 import { CommentForm } from "../comment/comment-form";
 import { CommentNodes } from "../comment/comment-nodes";
 import { HtmlTags } from "../common/html-tags";
@@ -552,7 +552,6 @@ export class Post extends Component<any, PostState> {
             community_view={res.data.community_view}
             moderators={res.data.moderators}
             admins={this.state.siteRes.admins}
-            online={res.data.online}
             enableNsfw={enableNsfw(this.state.siteRes)}
             showIcon
             allLanguages={this.state.siteRes.all_languages}
@@ -729,19 +728,14 @@ export class Post extends Component<any, PostState> {
 
   async handleBlockCommunity(form: BlockCommunity) {
     const blockCommunityRes = await HttpService.client.blockCommunity(form);
-    // TODO Probably isn't necessary
-    this.setState(s => {
-      if (
-        s.postRes.state == "success" &&
-        blockCommunityRes.state == "success"
-      ) {
-        s.postRes.data.community_view = blockCommunityRes.data.community_view;
-      }
-      return s;
-    });
-
     if (blockCommunityRes.state == "success") {
       updateCommunityBlock(blockCommunityRes.data);
+      this.setState(s => {
+        if (s.postRes.state == "success") {
+          s.postRes.data.community_view.blocked =
+            blockCommunityRes.data.blocked;
+        }
+      });
     }
   }