From f3c38ad5c8607fa44379f4f69156832e24489b12 Mon Sep 17 00:00:00 2001 From: Johann150 Date: Fri, 11 Nov 2022 18:08:57 +0100 Subject: [PATCH] server: only add unique cascade-delete notes --- packages/backend/src/services/note/delete.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/backend/src/services/note/delete.ts b/packages/backend/src/services/note/delete.ts index a8b186fc8..af9ad350a 100644 --- a/packages/backend/src/services/note/delete.ts +++ b/packages/backend/src/services/note/delete.ts @@ -105,6 +105,9 @@ async function findCascadingNotes(note: Note): Promise { }); await Promise.all(replies.map(reply => { + // only add unique notes + if (cascadingNotes.find((x) => x.id == reply.id) != null) return; + cascadingNotes.push(reply); return recursive(reply.id); }));