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