wip
This commit is contained in:
parent
1766e923db
commit
7352387045
|
|
@ -23,6 +23,7 @@ import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
|||
import { bindThis } from '@/decorators.js';
|
||||
import { MetaService } from '@/core/MetaService.js';
|
||||
import { SearchService } from '@/core/SearchService.js';
|
||||
import { ModerationLogService } from '@/core/ModerationLogService.js';
|
||||
|
||||
@Injectable()
|
||||
export class NoteDeleteService {
|
||||
|
|
@ -48,6 +49,7 @@ export class NoteDeleteService {
|
|||
private apDeliverManagerService: ApDeliverManagerService,
|
||||
private metaService: MetaService,
|
||||
private searchService: SearchService,
|
||||
private moderationLogService: ModerationLogService,
|
||||
private notesChart: NotesChart,
|
||||
private perUserNotesChart: PerUserNotesChart,
|
||||
private instanceChart: InstanceChart,
|
||||
|
|
@ -58,7 +60,7 @@ export class NoteDeleteService {
|
|||
* @param user 投稿者
|
||||
* @param note 投稿
|
||||
*/
|
||||
async delete(user: { id: MiUser['id']; uri: MiUser['uri']; host: MiUser['host']; isBot: MiUser['isBot']; }, note: MiNote, quiet = false) {
|
||||
async delete(user: { id: MiUser['id']; uri: MiUser['uri']; host: MiUser['host']; isBot: MiUser['isBot']; }, note: MiNote, quiet = false, deleter?: MiUser) {
|
||||
const deletedAt = new Date();
|
||||
const cascadingNotes = await this.findCascadingNotes(note);
|
||||
|
||||
|
|
@ -131,6 +133,14 @@ export class NoteDeleteService {
|
|||
id: note.id,
|
||||
userId: user.id,
|
||||
});
|
||||
|
||||
if (deleter && (note.userId !== deleter.id)) {
|
||||
this.moderationLogService.log(deleter, 'deleteNote', {
|
||||
noteId: note.id,
|
||||
noteUserId: note.userId,
|
||||
note: note,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@bindThis
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
}
|
||||
|
||||
// この操作を行うのが投稿者とは限らない(例えばモデレーター)ため
|
||||
await this.noteDeleteService.delete(await this.usersRepository.findOneByOrFail({ id: note.userId }), note);
|
||||
await this.noteDeleteService.delete(await this.usersRepository.findOneByOrFail({ id: note.userId }), note, false, me);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ export const moderationLogTypes = [
|
|||
'clearQueue',
|
||||
'promoteQueue',
|
||||
'deleteDriveFile',
|
||||
'deleteNote',
|
||||
] as const;
|
||||
|
||||
export type ModerationLogPayloads = {
|
||||
|
|
@ -87,4 +88,9 @@ export type ModerationLogPayloads = {
|
|||
fileId: string;
|
||||
fileUserId: string | null;
|
||||
};
|
||||
deleteNote: {
|
||||
noteId: string;
|
||||
noteUserId: string;
|
||||
note: any;
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@ export const moderationLogTypes = [
|
|||
'clearQueue',
|
||||
'promoteQueue',
|
||||
'deleteDriveFile',
|
||||
'deleteNote',
|
||||
] as const;
|
||||
|
||||
export type ModerationLogPayloads = {
|
||||
|
|
@ -105,4 +106,9 @@ export type ModerationLogPayloads = {
|
|||
fileId: string;
|
||||
fileUserId: string | null;
|
||||
};
|
||||
deleteNote: {
|
||||
noteId: string;
|
||||
noteUserId: string;
|
||||
note: any;
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue