summaryrefslogtreecommitdiff
path: root/packages/backend/src/queue/processors/DeleteAccountProcessorService.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/backend/src/queue/processors/DeleteAccountProcessorService.ts')
-rw-r--r--packages/backend/src/queue/processors/DeleteAccountProcessorService.ts10
1 files changed, 8 insertions, 2 deletions
diff --git a/packages/backend/src/queue/processors/DeleteAccountProcessorService.ts b/packages/backend/src/queue/processors/DeleteAccountProcessorService.ts
index 39dd801af0..3b7db5f05c 100644
--- a/packages/backend/src/queue/processors/DeleteAccountProcessorService.ts
+++ b/packages/backend/src/queue/processors/DeleteAccountProcessorService.ts
@@ -9,6 +9,7 @@ import type { DriveFile } from '@/models/entities/DriveFile.js';
import type { Note } from '@/models/entities/Note.js';
import { EmailService } from '@/core/EmailService.js';
import { bindThis } from '@/decorators.js';
+import { SearchService } from '@/core/SearchService.js';
import { QueueLoggerService } from '../QueueLoggerService.js';
import type * as Bull from 'bullmq';
import type { DbUserDeleteJobData } from '../types.js';
@@ -36,6 +37,7 @@ export class DeleteAccountProcessorService {
private driveService: DriveService,
private emailService: EmailService,
private queueLoggerService: QueueLoggerService,
+ private searchService: SearchService,
) {
this.logger = this.queueLoggerService.logger.createSubLogger('delete-account');
}
@@ -68,9 +70,13 @@ export class DeleteAccountProcessorService {
break;
}
- cursor = notes[notes.length - 1].id;
+ cursor = notes.at(-1)?.id ?? null;
await this.notesRepository.delete(notes.map(note => note.id));
+
+ for (const note of notes) {
+ await this.searchService.unindexNote(note);
+ }
}
this.logger.succ('All of notes deleted');
@@ -95,7 +101,7 @@ export class DeleteAccountProcessorService {
break;
}
- cursor = files[files.length - 1].id;
+ cursor = files.at(-1)?.id ?? null;
for (const file of files) {
await this.driveService.deleteFileSync(file);