-import { Component, linkEvent } from 'inferno';
-import { Link } from 'inferno-router';
-import { Subscription } from 'rxjs';
+import { Component, linkEvent } from "inferno";
+import { Link } from "inferno-router";
+import { Subscription } from "rxjs";
import {
UserOperation,
GetModlog,
ModBanView,
ModAddCommunityView,
ModAddView,
-} from 'lemmy-js-client';
-import { WebSocketService } from '../services';
+} from "lemmy-js-client";
+import { WebSocketService } from "../services";
import {
wsJsonToRes,
fetchLimit,
isBrowser,
wsUserOp,
wsClient,
-} from '../utils';
-import { MomentTime } from './moment-time';
-import { HtmlTags } from './html-tags';
-import moment from 'moment';
-import { i18n } from '../i18next';
-import { InitialFetchRequest } from 'shared/interfaces';
-import { UserListing } from './user-listing';
-import { CommunityLink } from './community-link';
-import { Spinner } from './icon';
+} from "../utils";
+import { MomentTime } from "./moment-time";
+import { HtmlTags } from "./html-tags";
+import moment from "moment";
+import { i18n } from "../i18next";
+import { InitialFetchRequest } from "shared/interfaces";
+import { UserListing } from "./user-listing";
+import { CommunityLink } from "./community-link";
+import { Spinner } from "./icon";
enum ModlogEnum {
ModRemovePost,
case ModlogEnum.ModRemovePost: {
let mrpv = i.view as ModRemovePostView;
return [
- mrpv.mod_remove_post.removed ? 'Removed ' : 'Restored ',
+ mrpv.mod_remove_post.removed ? "Removed " : "Restored ",
<span>
Post <Link to={`/post/${mrpv.post.id}`}>{mrpv.post.name}</Link>
</span>,
case ModlogEnum.ModLockPost: {
let mlpv = i.view as ModLockPostView;
return [
- mlpv.mod_lock_post.locked ? 'Locked ' : 'Unlocked ',
+ mlpv.mod_lock_post.locked ? "Locked " : "Unlocked ",
<span>
Post <Link to={`/post/${mlpv.post.id}`}>{mlpv.post.name}</Link>
</span>,
case ModlogEnum.ModStickyPost: {
let mspv = i.view as ModStickyPostView;
return [
- mspv.mod_sticky_post.stickied ? 'Stickied ' : 'Unstickied ',
+ mspv.mod_sticky_post.stickied ? "Stickied " : "Unstickied ",
<span>
Post <Link to={`/post/${mspv.post.id}`}>{mspv.post.name}</Link>
</span>,
case ModlogEnum.ModRemoveComment: {
let mrc = i.view as ModRemoveCommentView;
return [
- mrc.mod_remove_comment.removed ? 'Removed ' : 'Restored ',
+ mrc.mod_remove_comment.removed ? "Removed " : "Restored ",
<span>
- Comment{' '}
+ Comment{" "}
<Link to={`/post/${mrc.post.id}/comment/${mrc.comment.id}`}>
{mrc.comment.content}
</Link>
</span>,
<span>
- {' '}
+ {" "}
by <UserListing user={mrc.commenter} />
</span>,
mrc.mod_remove_comment.reason &&
case ModlogEnum.ModRemoveCommunity: {
let mrco = i.view as ModRemoveCommunityView;
return [
- mrco.mod_remove_community.removed ? 'Removed ' : 'Restored ',
+ mrco.mod_remove_community.removed ? "Removed " : "Restored ",
<span>
Community <CommunityLink community={mrco.community} />
</span>,
let mbfc = i.view as ModBanFromCommunityView;
return [
<span>
- {mbfc.mod_ban_from_community.banned ? 'Banned ' : 'Unbanned '}{' '}
+ {mbfc.mod_ban_from_community.banned ? "Banned " : "Unbanned "}{" "}
</span>,
<span>
<UserListing user={mbfc.banned_user} />
let mac = i.view as ModAddCommunityView;
return [
<span>
- {mac.mod_add_community.removed ? 'Removed ' : 'Appointed '}{' '}
+ {mac.mod_add_community.removed ? "Removed " : "Appointed "}{" "}
</span>,
<span>
<UserListing user={mac.modded_user} />
case ModlogEnum.ModBan: {
let mb = i.view as ModBanView;
return [
- <span>{mb.mod_ban.banned ? 'Banned ' : 'Unbanned '} </span>,
+ <span>{mb.mod_ban.banned ? "Banned " : "Unbanned "} </span>,
<span>
<UserListing user={mb.banned_user} />
</span>,
case ModlogEnum.ModAdd: {
let ma = i.view as ModAddView;
return [
- <span>{ma.mod_add.removed ? 'Removed ' : 'Appointed '} </span>,
+ <span>{ma.mod_add.removed ? "Removed " : "Appointed "} </span>,
<span>
<UserListing user={ma.modded_user} />
</span>,
className="text-body"
to={`/c/${this.state.communityName}`}
>
- /c/{this.state.communityName}{' '}
+ /c/{this.state.communityName}{" "}
</Link>
)}
- <span>{i18n.t('modlog')}</span>
+ <span>{i18n.t("modlog")}</span>
</h5>
<div class="table-responsive">
<table id="modlog_table" class="table table-sm table-hover">
<thead class="pointer">
<tr>
- <th> {i18n.t('time')}</th>
- <th>{i18n.t('mod')}</th>
- <th>{i18n.t('action')}</th>
+ <th> {i18n.t("time")}</th>
+ <th>{i18n.t("mod")}</th>
+ <th>{i18n.t("action")}</th>
</tr>
</thead>
{this.combined()}
class="btn btn-secondary mr-1"
onClick={linkEvent(this, this.prevPage)}
>
- {i18n.t('prev')}
+ {i18n.t("prev")}
</button>
)}
<button
class="btn btn-secondary"
onClick={linkEvent(this, this.nextPage)}
>
- {i18n.t('next')}
+ {i18n.t("next")}
</button>
</div>
);
}
static fetchInitialData(req: InitialFetchRequest): Promise<any>[] {
- let pathSplit = req.path.split('/');
+ let pathSplit = req.path.split("/");
let communityId = pathSplit[3];
let promises: Promise<any>[] = [];
parseMessage(msg: any) {
let op = wsUserOp(msg);
if (msg.error) {
- toast(i18n.t(msg.error), 'danger');
+ toast(i18n.t(msg.error), "danger");
return;
} else if (op == UserOperation.GetModlog) {
let data = wsJsonToRes<GetModlogResponse>(msg).data;