wip
This commit is contained in:
parent
f24e388458
commit
a87b99b41b
|
|
@ -2249,6 +2249,14 @@ export interface Locale {
|
|||
"mention": string;
|
||||
};
|
||||
};
|
||||
"_moderationLogTypes": {
|
||||
"roleAssigned": string;
|
||||
"roleUnassigned": string;
|
||||
"roleUpdated": string;
|
||||
"suspend": string;
|
||||
"unsuspend": string;
|
||||
"addEmoji": string;
|
||||
};
|
||||
}
|
||||
declare const locales: {
|
||||
[lang: string]: Locale;
|
||||
|
|
|
|||
|
|
@ -2161,3 +2161,13 @@ _webhookSettings:
|
|||
renote: "Renoteされたとき"
|
||||
reaction: "リアクションがあったとき"
|
||||
mention: "メンションされたとき"
|
||||
|
||||
_moderationLogTypes:
|
||||
assignRole: "ロールへアサイン"
|
||||
unassignRole: "ロールのアサイン解除"
|
||||
updateRole: "ロール設定更新"
|
||||
suspend: "凍結"
|
||||
unsuspend: "凍結解除"
|
||||
addCustomEmoji: "カスタム絵文字追加"
|
||||
updateServerSettings: "サーバー設定更新"
|
||||
updateUserNote: "モデレーションノート更新"
|
||||
|
|
|
|||
|
|
@ -412,7 +412,7 @@ export class RoleService implements OnApplicationShutdown {
|
|||
this.globalEventService.publishInternalEvent('userRoleAssigned', created);
|
||||
|
||||
if (moderator) {
|
||||
this.moderationLogService.log(moderator, 'roleAssigned', {
|
||||
this.moderationLogService.log(moderator, 'assignRole', {
|
||||
roleId: roleId,
|
||||
roleName: role.name,
|
||||
userId: userId,
|
||||
|
|
@ -446,7 +446,7 @@ export class RoleService implements OnApplicationShutdown {
|
|||
|
||||
if (moderator) {
|
||||
const role = await this.rolesRepository.findOneByOrFail({ id: roleId });
|
||||
this.moderationLogService.log(moderator, 'roleUnassigned', {
|
||||
this.moderationLogService.log(moderator, 'unassignRole', {
|
||||
roleId: roleId,
|
||||
roleName: role.name,
|
||||
userId: userId,
|
||||
|
|
@ -485,7 +485,7 @@ export class RoleService implements OnApplicationShutdown {
|
|||
this.globalEventService.publishInternalEvent('roleUpdated', updated);
|
||||
|
||||
if (moderator) {
|
||||
this.moderationLogService.log(moderator, 'roleUpdated', {
|
||||
this.moderationLogService.log(moderator, 'updateRole', {
|
||||
roleId: role.id,
|
||||
before: role,
|
||||
after: updated,
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
roleIdsThatCanBeUsedThisEmojiAsReaction: ps.roleIdsThatCanBeUsedThisEmojiAsReaction ?? [],
|
||||
});
|
||||
|
||||
this.moderationLogService.log(me, 'addEmoji', {
|
||||
this.moderationLogService.log(me, 'addCustomEmoji', {
|
||||
emojiId: emoji.id,
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
return;
|
||||
}
|
||||
|
||||
await this.roleService.assign(user.id, role.id, ps.expiresAt ? new Date(ps.expiresAt) : null);
|
||||
await this.roleService.assign(user.id, role.id, ps.expiresAt ? new Date(ps.expiresAt) : null, me);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
throw new ApiError(meta.errors.noSuchUser);
|
||||
}
|
||||
|
||||
await this.roleService.unassign(user.id, role.id);
|
||||
await this.roleService.unassign(user.id, role.id, me);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -447,7 +447,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
|
||||
const after = await this.metaService.fetch(true);
|
||||
|
||||
this.moderationLogService.log(me, 'updateMeta', {
|
||||
this.moderationLogService.log(me, 'updateServerSettings', {
|
||||
before,
|
||||
after,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
moderationNote: ps.text,
|
||||
});
|
||||
|
||||
this.moderationLogService.log(me, 'userNoteUpdated', {
|
||||
this.moderationLogService.log(me, 'updateServerSettings', {
|
||||
userId: user.id,
|
||||
before: currentProfile.moderationNote,
|
||||
after: ps.text,
|
||||
|
|
|
|||
|
|
@ -27,10 +27,10 @@ export const mutedNoteReasons = ['word', 'manual', 'spam', 'other'] as const;
|
|||
|
||||
export const ffVisibility = ['public', 'followers', 'private'] as const;
|
||||
|
||||
export const moderationLogTypes = ['updateMeta', 'suspend', 'unsuspend', 'userNoteUpdated', 'addEmoji', 'roleAssigned', 'roleUnassigned', 'roleUpdated', 'roleDeleted', 'clearQueue', 'promoteQueue'] as const;
|
||||
export const moderationLogTypes = ['updateServerSettings', 'suspend', 'unsuspend', 'updateUserNote', 'addCustomEmoji', 'assignRole', 'unassignRole', 'updateRole', 'deleteRole', 'clearQueue', 'promoteQueue'] as const;
|
||||
|
||||
export type ModerationLogPayloads = {
|
||||
updateMeta: {
|
||||
updateServerSettings: {
|
||||
before: any | null;
|
||||
after: any | null;
|
||||
};
|
||||
|
|
@ -40,31 +40,31 @@ export type ModerationLogPayloads = {
|
|||
unsuspend: {
|
||||
targetId: string;
|
||||
};
|
||||
userNoteUpdated: {
|
||||
updateUserNote: {
|
||||
userId: string;
|
||||
before: string | null;
|
||||
after: string | null;
|
||||
};
|
||||
addEmoji: {
|
||||
addCustomEmoji: {
|
||||
emojiId: string;
|
||||
};
|
||||
roleAssigned: {
|
||||
assignRole: {
|
||||
userId: string;
|
||||
roleId: string;
|
||||
roleName: string;
|
||||
expiresAt: string | null;
|
||||
};
|
||||
roleUnassigned: {
|
||||
unassignRole: {
|
||||
userId: string;
|
||||
roleId: string;
|
||||
roleName: string;
|
||||
};
|
||||
roleUpdated: {
|
||||
updateRole: {
|
||||
roleId: string;
|
||||
before: any;
|
||||
after: any;
|
||||
};
|
||||
roleDeleted: {
|
||||
deleteRole: {
|
||||
roleId: string;
|
||||
roleName: string;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
|
||||
<template>
|
||||
<MkFolder>
|
||||
<template #label>{{ log.type }}</template>
|
||||
<template #label>{{ i18n.ts._moderationLogTypes[log.type] }}</template>
|
||||
<template #icon>
|
||||
<MkAvatar :user="log.user" :class="$style.avatar"/>
|
||||
</template>
|
||||
|
|
@ -22,11 +22,11 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
<template v-else-if="log.type === 'unsuspend'">
|
||||
<div>{{ i18n.ts.user }}: {{ log.info.targetId }}</div>
|
||||
</template>
|
||||
<template v-else-if="log.type === 'roleAssigned'">
|
||||
<template v-else-if="log.type === 'assignRole'">
|
||||
<div>{{ i18n.ts.user }}: {{ log.info.userId }}</div>
|
||||
<div>{{ i18n.ts.role }}: {{ log.info.roleName }} [{{ log.info.roleId }}]</div>
|
||||
</template>
|
||||
<template v-else-if="log.type === 'roleUnassigned'">
|
||||
<template v-else-if="log.type === 'unassignRole'">
|
||||
<div>{{ i18n.ts.user }}: {{ log.info.userId }}</div>
|
||||
<div>{{ i18n.ts.role }}: {{ log.info.roleName }} [{{ log.info.roleId }}]</div>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -2524,8 +2524,8 @@ type ModerationLog = {
|
|||
userId: User['id'];
|
||||
user: UserDetailed | null;
|
||||
} & ({
|
||||
type: 'updateMeta';
|
||||
info: ModerationLogPayloads['updateMeta'];
|
||||
type: 'updateServerSettings';
|
||||
info: ModerationLogPayloads['updateServerSettings'];
|
||||
} | {
|
||||
type: 'suspend';
|
||||
info: ModerationLogPayloads['suspend'];
|
||||
|
|
@ -2533,23 +2533,23 @@ type ModerationLog = {
|
|||
type: 'unsuspend';
|
||||
info: ModerationLogPayloads['unsuspend'];
|
||||
} | {
|
||||
type: 'userNoteUpdated';
|
||||
info: ModerationLogPayloads['userNoteUpdated'];
|
||||
type: 'updateUserNote';
|
||||
info: ModerationLogPayloads['updateUserNote'];
|
||||
} | {
|
||||
type: 'addEmoji';
|
||||
info: ModerationLogPayloads['addEmoji'];
|
||||
type: 'addCustomEmoji';
|
||||
info: ModerationLogPayloads['addCustomEmoji'];
|
||||
} | {
|
||||
type: 'roleAssigned';
|
||||
info: ModerationLogPayloads['roleAssigned'];
|
||||
type: 'assignRole';
|
||||
info: ModerationLogPayloads['assignRole'];
|
||||
} | {
|
||||
type: 'roleUnassigned';
|
||||
info: ModerationLogPayloads['roleUnassigned'];
|
||||
type: 'unassignRole';
|
||||
info: ModerationLogPayloads['unassignRole'];
|
||||
} | {
|
||||
type: 'roleUpdated';
|
||||
info: ModerationLogPayloads['roleUpdated'];
|
||||
type: 'updateRole';
|
||||
info: ModerationLogPayloads['updateRole'];
|
||||
} | {
|
||||
type: 'roleDeleted';
|
||||
info: ModerationLogPayloads['roleDeleted'];
|
||||
type: 'deleteRole';
|
||||
info: ModerationLogPayloads['deleteRole'];
|
||||
} | {
|
||||
type: 'clearQueue';
|
||||
info: ModerationLogPayloads['clearQueue'];
|
||||
|
|
@ -2559,7 +2559,7 @@ type ModerationLog = {
|
|||
});
|
||||
|
||||
// @public (undocumented)
|
||||
export const moderationLogTypes: readonly ["updateMeta", "suspend", "unsuspend", "userNoteUpdated", "addEmoji", "roleAssigned", "roleUnassigned", "roleUpdated", "roleDeleted", "clearQueue", "promoteQueue"];
|
||||
export const moderationLogTypes: readonly ["updateServerSettings", "suspend", "unsuspend", "updateUserNote", "addCustomEmoji", "assignRole", "unassignRole", "updateRole", "deleteRole", "clearQueue", "promoteQueue"];
|
||||
|
||||
// @public (undocumented)
|
||||
export const mutedNoteReasons: readonly ["word", "manual", "spam", "other"];
|
||||
|
|
|
|||
|
|
@ -45,10 +45,10 @@ export const permissions = [
|
|||
'write:flash-likes',
|
||||
];
|
||||
|
||||
export const moderationLogTypes = ['updateMeta', 'suspend', 'unsuspend', 'userNoteUpdated', 'addEmoji', 'roleAssigned', 'roleUnassigned', 'roleUpdated', 'roleDeleted', 'clearQueue', 'promoteQueue'] as const;
|
||||
export const moderationLogTypes = ['updateServerSettings', 'suspend', 'unsuspend', 'updateUserNote', 'addCustomEmoji', 'assignRole', 'unassignRole', 'updateRole', 'deleteRole', 'clearQueue', 'promoteQueue'] as const;
|
||||
|
||||
export type ModerationLogPayloads = {
|
||||
updateMeta: {
|
||||
updateServerSettings: {
|
||||
before: any | null;
|
||||
after: any | null;
|
||||
};
|
||||
|
|
@ -58,31 +58,31 @@ export type ModerationLogPayloads = {
|
|||
unsuspend: {
|
||||
targetId: string;
|
||||
};
|
||||
userNoteUpdated: {
|
||||
updateUserNote: {
|
||||
userId: string;
|
||||
before: string | null;
|
||||
after: string | null;
|
||||
};
|
||||
addEmoji: {
|
||||
addCustomEmoji: {
|
||||
emojiId: string;
|
||||
};
|
||||
roleAssigned: {
|
||||
assignRole: {
|
||||
userId: string;
|
||||
roleId: string;
|
||||
roleName: string;
|
||||
expiresAt: string | null;
|
||||
};
|
||||
roleUnassigned: {
|
||||
unassignRole: {
|
||||
userId: string;
|
||||
roleId: string;
|
||||
roleName: string;
|
||||
};
|
||||
roleUpdated: {
|
||||
updateRole: {
|
||||
roleId: string;
|
||||
before: any;
|
||||
after: any;
|
||||
};
|
||||
roleDeleted: {
|
||||
deleteRole: {
|
||||
roleId: string;
|
||||
roleName: string;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -575,8 +575,8 @@ export type ModerationLog = {
|
|||
userId: User['id'];
|
||||
user: UserDetailed | null;
|
||||
} & ({
|
||||
type: 'updateMeta';
|
||||
info: ModerationLogPayloads['updateMeta'];
|
||||
type: 'updateServerSettings';
|
||||
info: ModerationLogPayloads['updateServerSettings'];
|
||||
} | {
|
||||
type: 'suspend';
|
||||
info: ModerationLogPayloads['suspend'];
|
||||
|
|
@ -584,23 +584,23 @@ export type ModerationLog = {
|
|||
type: 'unsuspend';
|
||||
info: ModerationLogPayloads['unsuspend'];
|
||||
} | {
|
||||
type: 'userNoteUpdated';
|
||||
info: ModerationLogPayloads['userNoteUpdated'];
|
||||
type: 'updateUserNote';
|
||||
info: ModerationLogPayloads['updateUserNote'];
|
||||
} | {
|
||||
type: 'addEmoji';
|
||||
info: ModerationLogPayloads['addEmoji'];
|
||||
type: 'addCustomEmoji';
|
||||
info: ModerationLogPayloads['addCustomEmoji'];
|
||||
} | {
|
||||
type: 'roleAssigned';
|
||||
info: ModerationLogPayloads['roleAssigned'];
|
||||
type: 'assignRole';
|
||||
info: ModerationLogPayloads['assignRole'];
|
||||
} | {
|
||||
type: 'roleUnassigned';
|
||||
info: ModerationLogPayloads['roleUnassigned'];
|
||||
type: 'unassignRole';
|
||||
info: ModerationLogPayloads['unassignRole'];
|
||||
} | {
|
||||
type: 'roleUpdated';
|
||||
info: ModerationLogPayloads['roleUpdated'];
|
||||
type: 'updateRole';
|
||||
info: ModerationLogPayloads['updateRole'];
|
||||
} | {
|
||||
type: 'roleDeleted';
|
||||
info: ModerationLogPayloads['roleDeleted'];
|
||||
type: 'deleteRole';
|
||||
info: ModerationLogPayloads['deleteRole'];
|
||||
} | {
|
||||
type: 'clearQueue';
|
||||
info: ModerationLogPayloads['clearQueue'];
|
||||
|
|
|
|||
Loading…
Reference in New Issue