fix(backend): Remove Meilisearch index when notes are deleted (#10988)

* fix(backend): Include feature to delete Meilisearch index notes

* Update variable name
`cascadingNotesFilter` -> `federatedLocalCascadingNotes`

* tweak

---------

Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
This commit is contained in:
Caipira 2023-07-08 21:31:38 +09:00 committed by GitHub
parent 7ec07d5fd2
commit 60366a4558
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 26 additions and 3 deletions

View file

@ -12,6 +12,7 @@ import { bindThis } from '@/decorators.js';
import { QueueLoggerService } from '../QueueLoggerService.js';
import type * as Bull from 'bullmq';
import type { DbUserDeleteJobData } from '../types.js';
import { SearchService } from "@/core/SearchService.js";
@Injectable()
export class DeleteAccountProcessorService {
@ -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');
}
@ -71,6 +73,10 @@ export class DeleteAccountProcessorService {
cursor = notes[notes.length - 1].id;
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');