mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-25 13:51:13 +00:00
Mod action history (#2437)
* Add action for viewing moderation history * Add translations * Remove unnecessary function * Update packageManager * Package manager
This commit is contained in:
parent
b2a3f29fe2
commit
d89dc07e71
5 changed files with 676 additions and 661 deletions
|
@ -1 +1 @@
|
|||
Subproject commit c88dd1e3b36ee1617f1b86acf94c1b7946e97cd4
|
||||
Subproject commit 866e4056656755f7b31e20094b46391e6931e3e7
|
1297
pnpm-lock.yaml
1297
pnpm-lock.yaml
File diff suppressed because it is too large
Load diff
|
@ -298,5 +298,8 @@
|
|||
<symbol id="icon-info" fill="currentColor" viewBox="0 0 256 256">
|
||||
<path d="M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm16-40a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176ZM112,84a12,12,0,1,1,12,12A12,12,0,0,1,112,84Z" />
|
||||
</symbol>
|
||||
<symbol id="icon-history" viewBox="0 0 256 256">
|
||||
<path d="M136,80v43.47l36.12,21.67a8,8,0,0,1-8.24,13.72l-40-24A8,8,0,0,1,120,128V80a8,8,0,0,1,16,0Zm-8-48A95.44,95.44,0,0,0,60.08,60.15C52.81,67.51,46.35,74.59,40,82V64a8,8,0,0,0-16,0v40a8,8,0,0,0,8,8H72a8,8,0,0,0,0-16H49c7.15-8.42,14.27-16.35,22.39-24.57a80,80,0,1,1,1.66,114.75,8,8,0,1,0-11,11.64A96,96,0,1,0,128,32Z" />
|
||||
</symbol>
|
||||
</defs>
|
||||
</svg>
|
||||
|
|
Before Width: | Height: | Size: 69 KiB After Width: | Height: | Size: 69 KiB |
|
@ -346,6 +346,20 @@ export default class ContentActionDropdown extends Component<
|
|||
/>
|
||||
</li>
|
||||
)}
|
||||
<li>
|
||||
<Link
|
||||
className="btn btn-link btn-sm d-flex align-items-center rounded-0 dropdown-item"
|
||||
to={`/modlog?${type === "post" ? "postId" : "commentId"}=${id}`}
|
||||
title={I18NextService.i18n.t("moderation_history")}
|
||||
aria-label={I18NextService.i18n.t("moderation_history")}
|
||||
data-tippy-content={I18NextService.i18n.t(
|
||||
"moderation_history",
|
||||
)}
|
||||
>
|
||||
<Icon icon="history" inline classes="me-2" />
|
||||
{I18NextService.i18n.t("moderation_history")}
|
||||
</Link>
|
||||
</li>
|
||||
{(this.canMod || this.canAdmin) && (
|
||||
<li>
|
||||
<ActionButton
|
||||
|
@ -415,7 +429,8 @@ export default class ContentActionDropdown extends Component<
|
|||
)}
|
||||
</>
|
||||
)}
|
||||
{(amCommunityCreator(this.id, moderators) || this.canAdmin) &&
|
||||
{(amCommunityCreator(creator.id, moderators) ||
|
||||
this.canAdmin) &&
|
||||
creator_is_moderator && (
|
||||
<li>
|
||||
<ActionButton
|
||||
|
@ -842,12 +857,6 @@ export default class ContentActionDropdown extends Component<
|
|||
);
|
||||
}
|
||||
|
||||
get id() {
|
||||
return this.props.type === "post"
|
||||
? this.props.postView.creator.id
|
||||
: this.props.commentView.creator.id;
|
||||
}
|
||||
|
||||
wrapHandler(handler: (arg?: any) => Promise<void>) {
|
||||
return async (arg?: any) => {
|
||||
await handler(arg);
|
||||
|
|
|
@ -107,6 +107,8 @@ export function getModlogQueryParams(source?: string): ModlogProps {
|
|||
modId: getIdFromString,
|
||||
userId: getIdFromString,
|
||||
page: getPageFromString,
|
||||
commentId: getIdFromString,
|
||||
postId: getIdFromString,
|
||||
},
|
||||
source,
|
||||
);
|
||||
|
@ -127,6 +129,8 @@ interface ModlogProps {
|
|||
userId?: number;
|
||||
modId?: number;
|
||||
actionType: ModlogActionType;
|
||||
postId?: number;
|
||||
commentId?: number;
|
||||
}
|
||||
|
||||
function getActionFromString(action?: string): ModlogActionType {
|
||||
|
@ -991,7 +995,7 @@ export class Modlog extends Component<ModlogRouteProps, ModlogState> {
|
|||
}
|
||||
|
||||
async refetch() {
|
||||
const { actionType, page, modId, userId } = this.props;
|
||||
const { actionType, page, modId, userId, postId, commentId } = this.props;
|
||||
const { communityId: urlCommunityId } = this.props.match.params;
|
||||
const communityId = getIdFromString(urlCommunityId);
|
||||
|
||||
|
@ -1007,6 +1011,8 @@ export class Modlog extends Component<ModlogRouteProps, ModlogState> {
|
|||
.hide_modlog_mod_names
|
||||
? modId
|
||||
: undefined,
|
||||
comment_id: commentId,
|
||||
post_id: postId,
|
||||
}),
|
||||
});
|
||||
|
||||
|
@ -1022,7 +1028,7 @@ export class Modlog extends Component<ModlogRouteProps, ModlogState> {
|
|||
|
||||
static async fetchInitialData({
|
||||
headers,
|
||||
query: { page, userId, modId: modId_, actionType },
|
||||
query: { page, userId, modId: modId_, actionType, commentId, postId },
|
||||
match: {
|
||||
params: { communityId: urlCommunityId },
|
||||
},
|
||||
|
@ -1043,6 +1049,8 @@ export class Modlog extends Component<ModlogRouteProps, ModlogState> {
|
|||
type_: actionType,
|
||||
mod_person_id: modId,
|
||||
other_person_id: userId,
|
||||
comment_id: commentId,
|
||||
post_id: postId,
|
||||
};
|
||||
|
||||
let communityResponse: RequestState<GetCommunityResponse> = EMPTY_REQUEST;
|
||||
|
|
Loading…
Reference in a new issue