enhance: improve moderation log
This commit is contained in:
parent
440f3144ae
commit
055464a624
1
locales/index.d.ts
vendored
1
locales/index.d.ts
vendored
@ -2277,6 +2277,7 @@ export interface Locale {
|
|||||||
"markSensitiveDriveFile": string;
|
"markSensitiveDriveFile": string;
|
||||||
"unmarkSensitiveDriveFile": string;
|
"unmarkSensitiveDriveFile": string;
|
||||||
"resolveAbuseReport": string;
|
"resolveAbuseReport": string;
|
||||||
|
"createInvitation": string;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
declare const locales: {
|
declare const locales: {
|
||||||
|
@ -2190,3 +2190,4 @@ _moderationLogTypes:
|
|||||||
markSensitiveDriveFile: "ファイルをセンシティブ付与"
|
markSensitiveDriveFile: "ファイルをセンシティブ付与"
|
||||||
unmarkSensitiveDriveFile: "ファイルをセンシティブ解除"
|
unmarkSensitiveDriveFile: "ファイルをセンシティブ解除"
|
||||||
resolveAbuseReport: "通報を解決"
|
resolveAbuseReport: "通報を解決"
|
||||||
|
createInvitation: "招待コードを作成"
|
||||||
|
@ -10,6 +10,7 @@ import { InviteCodeEntityService } from '@/core/entities/InviteCodeEntityService
|
|||||||
import { IdService } from '@/core/IdService.js';
|
import { IdService } from '@/core/IdService.js';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
import { generateInviteCode } from '@/misc/generate-invite-code.js';
|
import { generateInviteCode } from '@/misc/generate-invite-code.js';
|
||||||
|
import { ModerationLogService } from '@/core/ModerationLogService.js';
|
||||||
import { ApiError } from '../../../error.js';
|
import { ApiError } from '../../../error.js';
|
||||||
|
|
||||||
export const meta = {
|
export const meta = {
|
||||||
@ -60,6 +61,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||||||
|
|
||||||
private inviteCodeEntityService: InviteCodeEntityService,
|
private inviteCodeEntityService: InviteCodeEntityService,
|
||||||
private idService: IdService,
|
private idService: IdService,
|
||||||
|
private moderationLogService: ModerationLogService,
|
||||||
) {
|
) {
|
||||||
super(meta, paramDef, async (ps, me) => {
|
super(meta, paramDef, async (ps, me) => {
|
||||||
if (ps.expiresAt && isNaN(Date.parse(ps.expiresAt))) {
|
if (ps.expiresAt && isNaN(Date.parse(ps.expiresAt))) {
|
||||||
@ -78,6 +80,11 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||||||
}
|
}
|
||||||
|
|
||||||
const tickets = await Promise.all(ticketsPromises);
|
const tickets = await Promise.all(ticketsPromises);
|
||||||
|
|
||||||
|
this.moderationLogService.log(me, 'createInvitation', {
|
||||||
|
invitations: tickets,
|
||||||
|
});
|
||||||
|
|
||||||
return await this.inviteCodeEntityService.packMany(tickets, me);
|
return await this.inviteCodeEntityService.packMany(tickets, me);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -56,6 +56,7 @@ export const moderationLogTypes = [
|
|||||||
'markSensitiveDriveFile',
|
'markSensitiveDriveFile',
|
||||||
'unmarkSensitiveDriveFile',
|
'unmarkSensitiveDriveFile',
|
||||||
'resolveAbuseReport',
|
'resolveAbuseReport',
|
||||||
|
'createInvitation',
|
||||||
] as const;
|
] as const;
|
||||||
|
|
||||||
export type ModerationLogPayloads = {
|
export type ModerationLogPayloads = {
|
||||||
@ -198,4 +199,7 @@ export type ModerationLogPayloads = {
|
|||||||
report: any;
|
report: any;
|
||||||
forwarded: boolean;
|
forwarded: boolean;
|
||||||
};
|
};
|
||||||
|
createInvitation: {
|
||||||
|
invitations: any[];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
@ -2604,10 +2604,13 @@ type ModerationLog = {
|
|||||||
} | {
|
} | {
|
||||||
type: 'unmarkSensitiveDriveFile';
|
type: 'unmarkSensitiveDriveFile';
|
||||||
info: ModerationLogPayloads['unmarkSensitiveDriveFile'];
|
info: ModerationLogPayloads['unmarkSensitiveDriveFile'];
|
||||||
|
} | {
|
||||||
|
type: 'createInvitation';
|
||||||
|
info: ModerationLogPayloads['createInvitation'];
|
||||||
});
|
});
|
||||||
|
|
||||||
// @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", "resolveAbuseReport"];
|
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", "createInvitation"];
|
||||||
|
|
||||||
// @public (undocumented)
|
// @public (undocumented)
|
||||||
export const mutedNoteReasons: readonly ["word", "manual", "spam", "other"];
|
export const mutedNoteReasons: readonly ["word", "manual", "spam", "other"];
|
||||||
|
@ -74,6 +74,7 @@ export const moderationLogTypes = [
|
|||||||
'markSensitiveDriveFile',
|
'markSensitiveDriveFile',
|
||||||
'unmarkSensitiveDriveFile',
|
'unmarkSensitiveDriveFile',
|
||||||
'resolveAbuseReport',
|
'resolveAbuseReport',
|
||||||
|
'createInvitation',
|
||||||
] as const;
|
] as const;
|
||||||
|
|
||||||
export type ModerationLogPayloads = {
|
export type ModerationLogPayloads = {
|
||||||
@ -216,4 +217,7 @@ export type ModerationLogPayloads = {
|
|||||||
report: any;
|
report: any;
|
||||||
forwarded: boolean;
|
forwarded: boolean;
|
||||||
};
|
};
|
||||||
|
createInvitation: {
|
||||||
|
invitations: any[];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
@ -655,4 +655,7 @@ export type ModerationLog = {
|
|||||||
} | {
|
} | {
|
||||||
type: 'unmarkSensitiveDriveFile';
|
type: 'unmarkSensitiveDriveFile';
|
||||||
info: ModerationLogPayloads['unmarkSensitiveDriveFile'];
|
info: ModerationLogPayloads['unmarkSensitiveDriveFile'];
|
||||||
|
} | {
|
||||||
|
type: 'createInvitation';
|
||||||
|
info: ModerationLogPayloads['createInvitation'];
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user