mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-29 07:41:13 +00:00
Adding mod transfer community
This commit is contained in:
parent
03a2b467ef
commit
aaf181d842
3 changed files with 33 additions and 5 deletions
|
@ -69,7 +69,7 @@
|
||||||
"husky": "^7.0.1",
|
"husky": "^7.0.1",
|
||||||
"import-sort-style-module": "^6.0.0",
|
"import-sort-style-module": "^6.0.0",
|
||||||
"iso-639-1": "^2.1.9",
|
"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",
|
"lint-staged": "^11.0.1",
|
||||||
"mini-css-extract-plugin": "^2.1.0",
|
"mini-css-extract-plugin": "^2.1.0",
|
||||||
"node-fetch": "^2.6.1",
|
"node-fetch": "^2.6.1",
|
||||||
|
|
|
@ -15,6 +15,7 @@ import {
|
||||||
ModRemoveCommunityView,
|
ModRemoveCommunityView,
|
||||||
ModRemovePostView,
|
ModRemovePostView,
|
||||||
ModStickyPostView,
|
ModStickyPostView,
|
||||||
|
ModTransferCommunityView,
|
||||||
SiteView,
|
SiteView,
|
||||||
UserOperation,
|
UserOperation,
|
||||||
} from "lemmy-js-client";
|
} from "lemmy-js-client";
|
||||||
|
@ -48,6 +49,7 @@ enum ModlogEnum {
|
||||||
ModRemoveCommunity,
|
ModRemoveCommunity,
|
||||||
ModBanFromCommunity,
|
ModBanFromCommunity,
|
||||||
ModAddCommunity,
|
ModAddCommunity,
|
||||||
|
ModTransferCommunity,
|
||||||
ModAdd,
|
ModAdd,
|
||||||
ModBan,
|
ModBan,
|
||||||
}
|
}
|
||||||
|
@ -64,6 +66,7 @@ type ModlogType = {
|
||||||
| ModBanFromCommunityView
|
| ModBanFromCommunityView
|
||||||
| ModBanView
|
| ModBanView
|
||||||
| ModAddCommunityView
|
| ModAddCommunityView
|
||||||
|
| ModTransferCommunityView
|
||||||
| ModAddView;
|
| ModAddView;
|
||||||
when_: string;
|
when_: string;
|
||||||
};
|
};
|
||||||
|
@ -91,6 +94,7 @@ export class Modlog extends Component<any, ModlogState> {
|
||||||
banned_from_community: [],
|
banned_from_community: [],
|
||||||
banned: [],
|
banned: [],
|
||||||
added_to_community: [],
|
added_to_community: [],
|
||||||
|
transferred_to_community: [],
|
||||||
added: [],
|
added: [],
|
||||||
},
|
},
|
||||||
page: 1,
|
page: 1,
|
||||||
|
@ -184,6 +188,14 @@ export class Modlog extends Component<any, ModlogState> {
|
||||||
when_: r.mod_add_community.when_,
|
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 => ({
|
let added: ModlogType[] = res.added.map(r => ({
|
||||||
id: r.mod_add.id,
|
id: r.mod_add.id,
|
||||||
type_: ModlogEnum.ModAdd,
|
type_: ModlogEnum.ModAdd,
|
||||||
|
@ -207,6 +219,7 @@ export class Modlog extends Component<any, ModlogState> {
|
||||||
combined.push(...removed_communities);
|
combined.push(...removed_communities);
|
||||||
combined.push(...banned_from_community);
|
combined.push(...banned_from_community);
|
||||||
combined.push(...added_to_community);
|
combined.push(...added_to_community);
|
||||||
|
combined.push(...transferred_to_community);
|
||||||
combined.push(...added);
|
combined.push(...added);
|
||||||
combined.push(...banned);
|
combined.push(...banned);
|
||||||
|
|
||||||
|
@ -326,6 +339,21 @@ export class Modlog extends Component<any, ModlogState> {
|
||||||
</span>,
|
</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: {
|
case ModlogEnum.ModBan: {
|
||||||
let mb = i.view as ModBanView;
|
let mb = i.view as ModBanView;
|
||||||
return [
|
return [
|
||||||
|
|
|
@ -5342,10 +5342,10 @@ lcid@^1.0.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
invert-kv "^1.0.0"
|
invert-kv "^1.0.0"
|
||||||
|
|
||||||
lemmy-js-client@0.11.3-rc.4:
|
lemmy-js-client@0.11.4-rc.10:
|
||||||
version "0.11.3-rc.4"
|
version "0.11.4-rc.10"
|
||||||
resolved "https://registry.yarnpkg.com/lemmy-js-client/-/lemmy-js-client-0.11.3-rc.4.tgz#fd6ccad2a959a4ffe243b4a17451159bd8deda44"
|
resolved "https://registry.yarnpkg.com/lemmy-js-client/-/lemmy-js-client-0.11.4-rc.10.tgz#bbb5ae39fcac45c4ff667b1047069fb5148a0526"
|
||||||
integrity sha512-BWl5jW9KL+UHrwOjyhtSjG3YgCDoAfv9HCORT2EKTk6cfOG98abNOpnGgwvTt4Z2GxJ+5NShQVa4635TTj3PMw==
|
integrity sha512-8XwC6+jU2dMwlAVUj4HzF7yosHDinUobuhCC3yLJX2J7wgTSvDxEEH8kYXhwfNZpNJrCJTwT+RVx3X0Tl2+CYw==
|
||||||
|
|
||||||
levn@^0.4.1:
|
levn@^0.4.1:
|
||||||
version "0.4.1"
|
version "0.4.1"
|
||||||
|
|
Loading…
Reference in a new issue