diff --git a/packages/backend/src/queue/processors/AutoDeleteNotesProcessorService.ts b/packages/backend/src/queue/processors/AutoDeleteNotesProcessorService.ts index 818250b36e..b44676e665 100644 --- a/packages/backend/src/queue/processors/AutoDeleteNotesProcessorService.ts +++ b/packages/backend/src/queue/processors/AutoDeleteNotesProcessorService.ts @@ -57,14 +57,15 @@ export class AutoDeleteNotesProcessorService { const notes = await this.notesRepository.createQueryBuilder('note') .where('note."userId" = :userId', { userId: user.user.id }) .andWhere('note.id < :untilId', { untilId }) + .andWhere('note.id NOT IN (SELECT "noteId" FROM note_favorite WHERE "userId" = :userId)'); .getMany(); for (const note of notes) { - if (pinnedNoteIds.includes(note.id)) { - continue; - } + if (pinnedNoteIds.includes(note.id)) { + continue; + } - await this.noteDeleteService.delete(user, note); + await this.noteDeleteService.delete(user, note); } }