Adding mod transfer community (#373)

This commit is contained in:
Dessalines 2021-08-18 19:07:54 -04:00 committed by GitHub
parent 03a2b467ef
commit 62e410c382
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 33 additions and 5 deletions

View 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",

View 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 [

View file

@ -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"