]> Untitled Git - lemmy-ui.git/commitdiff
Differentiate between mods and admins in mod log (#597)
authorNutomic <me@nutomic.com>
Mon, 14 Mar 2022 20:09:29 +0000 (20:09 +0000)
committerGitHub <noreply@github.com>
Mon, 14 Mar 2022 20:09:29 +0000 (20:09 +0000)
src/shared/components/modlog.tsx

index cc3c7a1efd2a41e8e6ceb77d3b0d54132c146777..e01b81e99c9d351dde708e8967831423e5d0296b 100644 (file)
@@ -16,6 +16,7 @@ import {
   ModRemovePostView,
   ModStickyPostView,
   ModTransferCommunityView,
+  PersonSafe,
   SiteView,
   UserOperation,
 } from "lemmy-js-client";
@@ -399,7 +400,7 @@ export class Modlog extends Component<any, ModlogState> {
               {this.isAdminOrMod ? (
                 <PersonListing person={i.view.moderator} />
               ) : (
-                <div>{i18n.t("mod")}</div>
+                <div>{this.modOrAdminText(i.view.moderator)}</div>
               )}
             </td>
             <td>{this.renderModlogType(i)}</td>
@@ -424,6 +425,16 @@ export class Modlog extends Component<any, ModlogState> {
     return isAdmin || isMod;
   }
 
+  modOrAdminText(person: PersonSafe): Text {
+    if (
+      this.isoData.site_res.admins.map(a => a.person.id).includes(person.id)
+    ) {
+      return i18n.t("admin");
+    } else {
+      return i18n.t("mod");
+    }
+  }
+
   get documentTitle(): string {
     return `Modlog - ${this.state.site_view.site.name}`;
   }