]> Untitled Git - lemmy-ui.git/commitdiff
pull latest main
authorAlec Armbruster <alectrocute@gmail.com>
Fri, 16 Jun 2023 22:51:51 +0000 (18:51 -0400)
committerAlec Armbruster <alectrocute@gmail.com>
Fri, 16 Jun 2023 22:51:51 +0000 (18:51 -0400)
1  2 
src/shared/components/person/settings.tsx
src/shared/components/post/post.tsx

index 564daff4287e9650cbcc7967845db272b5622f82,56d57a7a56850778c7e1a65923d36b4b38e2e0e9..3c8e9fcdd743444b24ace411615d5aa7746d208c
@@@ -18,13 -18,13 +18,12 @@@ import 
    Choice,
    capitalizeFirstLetter,
    communityToChoice,
 -  debounce,
    elementUrl,
    emDash,
    enableNsfw,
    fetchCommunities,
    fetchThemeList,
    fetchUsers,
-   getLanguages,
    myAuth,
    myAuthRequired,
    personToChoice,
@@@ -37,7 -37,6 +36,7 @@@
    updateCommunityBlock,
    updatePersonBlock,
  } from "../../utils";
 +import { debounce } from "../../utils/helpers/debounce";
  import { HtmlTags } from "../common/html-tags";
  import { Icon, Spinner } from "../common/icon";
  import { ImageUploadForm } from "../common/image-upload-form";
@@@ -1058,12 -1057,12 +1057,12 @@@ export class Settings extends Component
    }
  
    handleInterfaceLangChange(i: Settings, event: any) {
+     const newLang = event.target.value ?? "browser";
+     i18n.changeLanguage(newLang === "browser" ? navigator.languages : newLang);
      i.setState(
        s => ((s.saveUserSettingsForm.interface_language = event.target.value), s)
      );
-     i18n.changeLanguage(
-       getLanguages(i.state.saveUserSettingsForm.interface_language).at(0)
-     );
    }
  
    handleDiscussionLanguageChange(val: number[]) {
index 2c61f79e75815e17bcd4bd6f1ac3f8a5fdf027da,05e4d9b918fdb116a193b5d4da7592f9347879a1..a471e649139c368d10c570ebd2d5303f4ad2203c
@@@ -64,6 -64,7 +64,6 @@@ import 
    buildCommentsTree,
    commentsToFlatNodes,
    commentTreeMaxDepth,
 -  debounce,
    editComment,
    editWith,
    enableDownvotes,
@@@ -83,7 -84,6 +83,7 @@@
    updatePersonBlock,
  } from "../../utils";
  import { isBrowser } from "../../utils/browser/is-browser";
 +import { debounce } from "../../utils/helpers/debounce";
  import { CommentForm } from "../comment/comment-form";
  import { CommentNodes } from "../comment/comment-nodes";
  import { HtmlTags } from "../common/html-tags";
@@@ -552,7 -552,6 +552,6 @@@ export class Post extends Component<any
              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}
  
    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;
+         }
+       });
      }
    }