From: Dessalines Date: Wed, 18 Aug 2021 23:07:54 +0000 (-0400) Subject: Adding mod transfer community (#373) X-Git-Url: http://these/git/%7B%60%24%7BwebArchiveUrl%7D/%22%7B%7D/%22https:/nerdica.net/README.md?a=commitdiff_plain;h=62e410c3822900bdd340bd799f4cb2c7969ddf0d;p=lemmy-ui.git Adding mod transfer community (#373) --- diff --git a/package.json b/package.json index b0ec001..1b1d6ac 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/shared/components/modlog.tsx b/src/shared/components/modlog.tsx index f41a365..fc875f8 100644 --- a/src/shared/components/modlog.tsx +++ b/src/shared/components/modlog.tsx @@ -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 { banned_from_community: [], banned: [], added_to_community: [], + transferred_to_community: [], added: [], }, page: 1, @@ -184,6 +188,14 @@ export class Modlog extends Component { 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 { 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 { , ]; } + case ModlogEnum.ModTransferCommunity: { + let mtc = i.view as ModTransferCommunityView; + return [ + + {mtc.mod_transfer_community.removed ? "Removed " : "Transferred "}{" "} + , + + + , + to , + + + , + ]; + } case ModlogEnum.ModBan: { let mb = i.view as ModBanView; return [ diff --git a/yarn.lock b/yarn.lock index 9d807e6..563bf7a 100644 --- 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"