]> Untitled Git - lemmy-ui.git/commitdiff
Adding mod transfer community (#373)
authorDessalines <dessalines@users.noreply.github.com>
Wed, 18 Aug 2021 23:07:54 +0000 (19:07 -0400)
committerGitHub <noreply@github.com>
Wed, 18 Aug 2021 23:07:54 +0000 (19:07 -0400)
package.json
src/shared/components/modlog.tsx
yarn.lock

index b0ec0014a6b5080e78df4dea9990b267a8febcb1..1b1d6ac91dce692a14815af6dd60b7a58d310f06 100644 (file)
@@ -69,7 +69,7 @@
     "husky": "^7.0.1",
     "import-sort-style-module": "^6.0.0",
     "iso-639-1": "^2.1.9",
-    "lemmy-js-client": "0.11.3-rc.4",
+    "lemmy-js-client": "0.11.4-rc.10",
     "lint-staged": "^11.0.1",
     "mini-css-extract-plugin": "^2.1.0",
     "node-fetch": "^2.6.1",
index f41a3658c22d6c5fe9da90bed7c58dc041a3b174..fc875f81277632b5aef36a4b7e41e295cbccd96b 100644 (file)
@@ -15,6 +15,7 @@ import {
   ModRemoveCommunityView,
   ModRemovePostView,
   ModStickyPostView,
+  ModTransferCommunityView,
   SiteView,
   UserOperation,
 } from "lemmy-js-client";
@@ -48,6 +49,7 @@ enum ModlogEnum {
   ModRemoveCommunity,
   ModBanFromCommunity,
   ModAddCommunity,
+  ModTransferCommunity,
   ModAdd,
   ModBan,
 }
@@ -64,6 +66,7 @@ type ModlogType = {
     | ModBanFromCommunityView
     | ModBanView
     | ModAddCommunityView
+    | ModTransferCommunityView
     | ModAddView;
   when_: string;
 };
@@ -91,6 +94,7 @@ export class Modlog extends Component<any, ModlogState> {
       banned_from_community: [],
       banned: [],
       added_to_community: [],
+      transferred_to_community: [],
       added: [],
     },
     page: 1,
@@ -184,6 +188,14 @@ export class Modlog extends Component<any, ModlogState> {
       when_: r.mod_add_community.when_,
     }));
 
+    let transferred_to_community: ModlogType[] =
+      res.transferred_to_community.map(r => ({
+        id: r.mod_transfer_community.id,
+        type_: ModlogEnum.ModTransferCommunity,
+        view: r,
+        when_: r.mod_transfer_community.when_,
+      }));
+
     let added: ModlogType[] = res.added.map(r => ({
       id: r.mod_add.id,
       type_: ModlogEnum.ModAdd,
@@ -207,6 +219,7 @@ export class Modlog extends Component<any, ModlogState> {
     combined.push(...removed_communities);
     combined.push(...banned_from_community);
     combined.push(...added_to_community);
+    combined.push(...transferred_to_community);
     combined.push(...added);
     combined.push(...banned);
 
@@ -326,6 +339,21 @@ export class Modlog extends Component<any, ModlogState> {
           </span>,
         ];
       }
+      case ModlogEnum.ModTransferCommunity: {
+        let mtc = i.view as ModTransferCommunityView;
+        return [
+          <span>
+            {mtc.mod_transfer_community.removed ? "Removed " : "Transferred "}{" "}
+          </span>,
+          <span>
+            <CommunityLink community={mtc.community} />
+          </span>,
+          <span> to </span>,
+          <span>
+            <PersonListing person={mtc.modded_person} />
+          </span>,
+        ];
+      }
       case ModlogEnum.ModBan: {
         let mb = i.view as ModBanView;
         return [
index 9d807e68645277625e0c79bd3d90fe1f68821e0b..563bf7ac27469286f7d846684b00762ab0d669ea 100644 (file)
--- a/yarn.lock
+++ b/yarn.lock
@@ -5342,10 +5342,10 @@ lcid@^1.0.0:
   dependencies:
     invert-kv "^1.0.0"
 
-lemmy-js-client@0.11.3-rc.4:
-  version "0.11.3-rc.4"
-  resolved "https://registry.yarnpkg.com/lemmy-js-client/-/lemmy-js-client-0.11.3-rc.4.tgz#fd6ccad2a959a4ffe243b4a17451159bd8deda44"
-  integrity sha512-BWl5jW9KL+UHrwOjyhtSjG3YgCDoAfv9HCORT2EKTk6cfOG98abNOpnGgwvTt4Z2GxJ+5NShQVa4635TTj3PMw==
+lemmy-js-client@0.11.4-rc.10:
+  version "0.11.4-rc.10"
+  resolved "https://registry.yarnpkg.com/lemmy-js-client/-/lemmy-js-client-0.11.4-rc.10.tgz#bbb5ae39fcac45c4ff667b1047069fb5148a0526"
+  integrity sha512-8XwC6+jU2dMwlAVUj4HzF7yosHDinUobuhCC3yLJX2J7wgTSvDxEEH8kYXhwfNZpNJrCJTwT+RVx3X0Tl2+CYw==
 
 levn@^0.4.1:
   version "0.4.1"