delete fetch logs when a note or user is deleted
This commit is contained in:
parent
dbaeb7f2ac
commit
9de5ecae51
3 changed files with 50 additions and 2 deletions
|
|
@ -15,6 +15,7 @@ import type { MiNoteReaction } from '@/models/NoteReaction.js';
|
|||
import { EmailService } from '@/core/EmailService.js';
|
||||
import { bindThis } from '@/decorators.js';
|
||||
import { SearchService } from '@/core/SearchService.js';
|
||||
import { ApLogService } from '@/core/ApLogService.js';
|
||||
import { ReactionService } from '@/core/ReactionService.js';
|
||||
import { QueueLoggerService } from '../QueueLoggerService.js';
|
||||
import type * as Bull from 'bullmq';
|
||||
|
|
@ -45,6 +46,7 @@ export class DeleteAccountProcessorService {
|
|||
private queueLoggerService: QueueLoggerService,
|
||||
private searchService: SearchService,
|
||||
private reactionService: ReactionService,
|
||||
private readonly apLogService: ApLogService,
|
||||
) {
|
||||
this.logger = this.queueLoggerService.logger.createSubLogger('delete-account');
|
||||
}
|
||||
|
|
@ -84,6 +86,13 @@ export class DeleteAccountProcessorService {
|
|||
for (const note of notes) {
|
||||
await this.searchService.unindexNote(note);
|
||||
}
|
||||
|
||||
// Delete note AP logs
|
||||
const noteUris = notes.map(n => n.uri).filter(u => !!u) as string[];
|
||||
if (noteUris.length > 0) {
|
||||
await this.apLogService.deleteObjectLogs(noteUris)
|
||||
.catch(err => this.logger.error(err, `Failed to delete AP logs for notes of user '${user.uri ?? user.id}'`));
|
||||
}
|
||||
}
|
||||
|
||||
this.logger.succ('All of notes deleted');
|
||||
|
|
@ -149,6 +158,13 @@ export class DeleteAccountProcessorService {
|
|||
this.logger.succ('All of files deleted');
|
||||
}
|
||||
|
||||
{ // Delete actor logs
|
||||
if (user.uri) {
|
||||
await this.apLogService.deleteObjectLogs(user.uri)
|
||||
.catch(err => this.logger.error(err, `Failed to delete AP logs for user '${user.uri}'`));
|
||||
}
|
||||
}
|
||||
|
||||
{ // Send email notification
|
||||
const profile = await this.userProfilesRepository.findOneByOrFail({ userId: user.id });
|
||||
if (profile.email && profile.emailVerified) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue