X-Git-Url: http://these/git/?a=blobdiff_plain;f=src%2Fshared%2Fcomponents%2Fmodlog.tsx;h=ca1cb3326b2cfef3a2ca454d00d071d454e72abc;hb=ed0fd264de3d2162a3837733632fee69696681aa;hp=dd4f56fac7719698ad97860e2943862fd7a49a2c;hpb=d0dff77377a84611ab5cf624123e84c95aedf1ff;p=lemmy-ui.git diff --git a/src/shared/components/modlog.tsx b/src/shared/components/modlog.tsx index dd4f56f..ca1cb33 100644 --- a/src/shared/components/modlog.tsx +++ b/src/shared/components/modlog.tsx @@ -7,6 +7,7 @@ import { } from "@utils/app"; import { debounce, + formatPastDate, getIdFromString, getPageFromString, getQueryParams, @@ -15,8 +16,6 @@ import { import { amAdmin, amMod } from "@utils/roles"; import type { QueryParams } from "@utils/types"; import { Choice, RouteDataResponse } from "@utils/types"; -import formatDistanceToNowStrict from "date-fns/formatDistanceToNowStrict"; -import parseISO from "date-fns/parseISO"; import { NoOptionI18nKeys } from "i18next"; import { Component, linkEvent } from "inferno"; import { T } from "inferno-i18next-dess"; @@ -119,10 +118,6 @@ function getActionFromString(action?: string): ModlogActionType { return action !== undefined ? (action as ModlogActionType) : "All"; } -function getExpires(expires: string) { - return formatDistanceToNowStrict(parseISO(expires)); -} - const getModlogActionMapper = ( actionType: ModlogActionType, @@ -317,6 +312,7 @@ function renderModlogType({ type_, view }: ModlogType) { const { mod_feature_post: { featured, is_featured_community }, post: { id, name }, + community, } = view as ModFeaturePostView; return ( @@ -325,7 +321,12 @@ function renderModlogType({ type_, view }: ModlogType) { Post {name} - {is_featured_community ? " In Community" : " In Local"} + + {is_featured_community + ? " in community " + : " in Local, from community "} + + ); } @@ -376,7 +377,7 @@ function renderModlogType({ type_, view }: ModlogType) { )} {expires && ( -
expires: {getExpires(expires)}
+
expires: {formatPastDate(expires)}
)} @@ -408,7 +409,7 @@ function renderModlogType({ type_, view }: ModlogType) { )} {expires && ( -
expires: {getExpires(expires)}
+
expires: {formatPastDate(expires)}
)} @@ -472,7 +473,7 @@ function renderModlogType({ type_, view }: ModlogType) { )} {expires && ( -
expires: {getExpires(expires)}
+
expires: {formatPastDate(expires)}
)} @@ -537,7 +538,7 @@ function renderModlogType({ type_, view }: ModlogType) { return ( <> - Purged a Post from from + Purged a Post from {reason && ( @@ -691,6 +692,10 @@ export class Modlog extends Component< } } + async componentDidMount() { + await this.refetch(); + } + get combined() { const res = this.state.res; const combined = res.state == "success" ? buildCombined(res.data) : []; @@ -752,87 +757,83 @@ export class Modlog extends Component< path={this.context.router.route.match.url} /> -
-
- - - ### - -
- {this.state.communityRes.state === "success" && ( -
- - /c/{this.state.communityRes.data.community_view.community.name}{" "} - - {I18NextService.i18n.t("modlog")} -
- )} -
-
- -
+

{I18NextService.i18n.t("modlog")}

+ +
+ + + ### + +
+ {this.state.communityRes.state === "success" && ( +
+ + /c/{this.state.communityRes.data.community_view.community.name}{" "} + + {I18NextService.i18n.t("modlog")} +
+ )} +
+
+
-
+
+
+ + {!this.isoData.site_res.site_view.local_site + .hide_modlog_mod_names && ( - {!this.isoData.site_res.site_view.local_site - .hide_modlog_mod_names && ( - - )} -
- {this.renderModlogTable()} + )}
+ {this.renderModlogTable()}
); }