enhance: improve moderation log

This commit is contained in:
syuilo 2023-09-25 16:03:43 +09:00
parent ee44f35fea
commit bd19d75c9c
7 changed files with 28 additions and 1 deletions

1
locales/index.d.ts vendored
View File

@ -2276,6 +2276,7 @@ export interface Locale {
"unsuspendRemoteInstance": string; "unsuspendRemoteInstance": string;
"markSensitiveDriveFile": string; "markSensitiveDriveFile": string;
"unmarkSensitiveDriveFile": string; "unmarkSensitiveDriveFile": string;
"resolveAbuseReport": string;
}; };
} }
declare const locales: { declare const locales: {

View File

@ -2189,3 +2189,4 @@ _moderationLogTypes:
unsuspendRemoteInstance: "リモートサーバーを再開" unsuspendRemoteInstance: "リモートサーバーを再開"
markSensitiveDriveFile: "ファイルをセンシティブ付与" markSensitiveDriveFile: "ファイルをセンシティブ付与"
unmarkSensitiveDriveFile: "ファイルをセンシティブ解除" unmarkSensitiveDriveFile: "ファイルをセンシティブ解除"
resolveAbuseReport: "通報を解決"

View File

@ -10,6 +10,7 @@ import { InstanceActorService } from '@/core/InstanceActorService.js';
import { QueueService } from '@/core/QueueService.js'; import { QueueService } from '@/core/QueueService.js';
import { ApRendererService } from '@/core/activitypub/ApRendererService.js'; import { ApRendererService } from '@/core/activitypub/ApRendererService.js';
import { DI } from '@/di-symbols.js'; import { DI } from '@/di-symbols.js';
import { ModerationLogService } from '@/core/ModerationLogService.js';
export const meta = { export const meta = {
tags: ['admin'], tags: ['admin'],
@ -41,6 +42,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
private queueService: QueueService, private queueService: QueueService,
private instanceActorService: InstanceActorService, private instanceActorService: InstanceActorService,
private apRendererService: ApRendererService, private apRendererService: ApRendererService,
private moderationLogService: ModerationLogService,
) { ) {
super(meta, paramDef, async (ps, me) => { super(meta, paramDef, async (ps, me) => {
const report = await this.abuseUserReportsRepository.findOneBy({ id: ps.reportId }); const report = await this.abuseUserReportsRepository.findOneBy({ id: ps.reportId });
@ -61,6 +63,12 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
assigneeId: me.id, assigneeId: me.id,
forwarded: ps.forward && report.targetUserHost != null, forwarded: ps.forward && report.targetUserHost != null,
}); });
this.moderationLogService.log(me, 'resolveAbuseReport', {
reportId: report.id,
report: report,
forwarded: ps.forward && report.targetUserHost != null,
});
}); });
} }
} }

View File

@ -55,6 +55,7 @@ export const moderationLogTypes = [
'unsuspendRemoteInstance', 'unsuspendRemoteInstance',
'markSensitiveDriveFile', 'markSensitiveDriveFile',
'unmarkSensitiveDriveFile', 'unmarkSensitiveDriveFile',
'resolveAbuseReport',
] as const; ] as const;
export type ModerationLogPayloads = { export type ModerationLogPayloads = {
@ -192,4 +193,9 @@ export type ModerationLogPayloads = {
fileUserUsername: string | null; fileUserUsername: string | null;
fileUserHost: string | null; fileUserHost: string | null;
}; };
resolveAbuseReport: {
reportId: string;
report: any;
forwarded: boolean;
};
}; };

View File

@ -75,6 +75,11 @@ SPDX-License-Identifier: AGPL-3.0-only
<CodeDiff :context="5" :hideHeader="true" :oldString="JSON5.stringify(log.info.before, null, '\t')" :newString="JSON5.stringify(log.info.after, null, '\t')" language="javascript" maxHeight="300px"/> <CodeDiff :context="5" :hideHeader="true" :oldString="JSON5.stringify(log.info.before, null, '\t')" :newString="JSON5.stringify(log.info.after, null, '\t')" language="javascript" maxHeight="300px"/>
</div> </div>
</template> </template>
<details>
<summary>raw</summary>
<pre>{{ JSON5.stringify(log, null, '\t') }}</pre>
</details>
</div> </div>
</MkFolder> </MkFolder>
</template> </template>

View File

@ -2607,7 +2607,7 @@ type ModerationLog = {
}); });
// @public (undocumented) // @public (undocumented)
export const moderationLogTypes: readonly ["updateServerSettings", "suspend", "unsuspend", "updateUserNote", "addCustomEmoji", "updateCustomEmoji", "deleteCustomEmoji", "assignRole", "unassignRole", "createRole", "updateRole", "deleteRole", "clearQueue", "promoteQueue", "deleteDriveFile", "deleteNote", "createGlobalAnnouncement", "createUserAnnouncement", "updateGlobalAnnouncement", "updateUserAnnouncement", "deleteGlobalAnnouncement", "deleteUserAnnouncement", "resetPassword", "suspendRemoteInstance", "unsuspendRemoteInstance", "markSensitiveDriveFile", "unmarkSensitiveDriveFile"]; export const moderationLogTypes: readonly ["updateServerSettings", "suspend", "unsuspend", "updateUserNote", "addCustomEmoji", "updateCustomEmoji", "deleteCustomEmoji", "assignRole", "unassignRole", "createRole", "updateRole", "deleteRole", "clearQueue", "promoteQueue", "deleteDriveFile", "deleteNote", "createGlobalAnnouncement", "createUserAnnouncement", "updateGlobalAnnouncement", "updateUserAnnouncement", "deleteGlobalAnnouncement", "deleteUserAnnouncement", "resetPassword", "suspendRemoteInstance", "unsuspendRemoteInstance", "markSensitiveDriveFile", "unmarkSensitiveDriveFile", "resolveAbuseReport"];
// @public (undocumented) // @public (undocumented)
export const mutedNoteReasons: readonly ["word", "manual", "spam", "other"]; export const mutedNoteReasons: readonly ["word", "manual", "spam", "other"];

View File

@ -73,6 +73,7 @@ export const moderationLogTypes = [
'unsuspendRemoteInstance', 'unsuspendRemoteInstance',
'markSensitiveDriveFile', 'markSensitiveDriveFile',
'unmarkSensitiveDriveFile', 'unmarkSensitiveDriveFile',
'resolveAbuseReport',
] as const; ] as const;
export type ModerationLogPayloads = { export type ModerationLogPayloads = {
@ -210,4 +211,9 @@ export type ModerationLogPayloads = {
fileUserUsername: string | null; fileUserUsername: string | null;
fileUserHost: string | null; fileUserHost: string | null;
}; };
resolveAbuseReport: {
reportId: string;
report: any;
forwarded: boolean;
};
}; };