X-Git-Url: http://these/git/?a=blobdiff_plain;f=src%2Fshared%2Fcomponents%2Fmodlog.tsx;h=e8192d27caa21963f3203d428313e7839d726ab5;hb=c2f628312f76c726f002d3bafbe8eb9f78109947;hp=a22c20b8f61415c533337b6c80bc53a747efff03;hpb=dbb5c10da9b17c5530ce19357d5f286d3a8adb56;p=lemmy-ui.git diff --git a/src/shared/components/modlog.tsx b/src/shared/components/modlog.tsx index a22c20b..e8192d2 100644 --- a/src/shared/components/modlog.tsx +++ b/src/shared/components/modlog.tsx @@ -38,7 +38,6 @@ import { amAdmin, amMod, auth, - choicesConfig, choicesModLogConfig, debounce, fetchLimit, @@ -60,20 +59,20 @@ type ModlogType = { type_: ModlogActionType; moderator: Option; view: - | ModRemovePostView - | ModLockPostView - | ModStickyPostView - | ModRemoveCommentView - | ModRemoveCommunityView - | ModBanFromCommunityView - | ModBanView - | ModAddCommunityView - | ModTransferCommunityView - | ModAddView - | AdminPurgePersonView - | AdminPurgeCommunityView - | AdminPurgePostView - | AdminPurgeCommentView; + | ModRemovePostView + | ModLockPostView + | ModStickyPostView + | ModRemoveCommentView + | ModRemoveCommunityView + | ModBanFromCommunityView + | ModBanView + | ModAddCommunityView + | ModTransferCommunityView + | ModAddView + | AdminPurgePersonView + | AdminPurgeCommunityView + | AdminPurgePostView + | AdminPurgeCommentView; when_: string; }; var Choices: any; @@ -85,13 +84,13 @@ interface ModlogState { res: Option; communityId: Option; communityMods: Option; - communityName: Option, + communityName: Option; page: number; siteRes: GetSiteResponse; loading: boolean; - filter_action: ModlogActionType, - filter_user: Option, - filter_mod: Option, + filter_action: ModlogActionType; + filter_user: Option; + filter_mod: Option; } export class Modlog extends Component { @@ -553,7 +552,10 @@ export class Modlog extends Component { modOrAdminText(person: Option): string { return person.match({ - some: res => this.isoData.site_res.admins.map(a => a.person.id).includes(res.id) ? i18n.t("admin") : i18n.t("mod"), + some: res => + this.isoData.site_res.admins.map(a => a.person.id).includes(res.id) + ? i18n.t("admin") + : i18n.t("mod"), none: i18n.t("mod"), }); } @@ -581,19 +583,14 @@ export class Modlog extends Component { ) : (
- { - this.state.communityName.match({ + {this.state.communityName.match({ some: name => ( - + /c/{name}{" "} ), none: <>, - }) - } + })} {i18n.t("modlog")}
@@ -601,37 +598,61 @@ export class Modlog extends Component { value={this.state.filter_action} onChange={linkEvent(this, this.handleFilterActionChange)} className="custom-select col-4 mb-2" - aria-label="action"> - + aria-label="action" + > + - - - - - - - - - - + + + + + + + + + + - { - this.state.siteRes.site_view.match({ - some: site_view => !site_view.site.hide_modlog_mod_names.unwrapOr(false) && ( + {this.state.siteRes.site_view.match({ + some: site_view => + !site_view.site.hide_modlog_mod_names.unwrapOr(false) && ( ), - none: <>, - }) - } + none: <>, + })} +
@@ -710,10 +731,12 @@ export class Modlog extends Component { try { let users = (await fetchUsers(e.detail.value)).users; this.userChoices.setChoices( - users.map(u => {return { - value: u.person.id.toString(), - label: u.person.name, - }}), + users.map(u => { + return { + value: u.person.id.toString(), + label: u.person.name, + }; + }), "value", "label", true @@ -748,10 +771,12 @@ export class Modlog extends Component { try { let mods = (await fetchUsers(e.detail.value)).users; this.modChoices.setChoices( - mods.map(u => {return { - value: u.person.id.toString(), - label: u.person.name, - }}), + mods.map(u => { + return { + value: u.person.id.toString(), + label: u.person.name, + }; + }), "value", "label", true @@ -778,7 +803,7 @@ export class Modlog extends Component { mod_person_id: None, auth: req.auth, type_: ModlogActionType.All, - other_person_id: None + other_person_id: None, }); promises.push(req.client.getModlog(modlogForm));