From 9a96ac02fcc6b0d49a4123f585434ce0bf19766e Mon Sep 17 00:00:00 2001 From: Mar0xy Date: Fri, 6 Oct 2023 21:12:33 +0200 Subject: [PATCH] fix: adding poll to note during edit breakage --- packages/backend/src/core/NoteEditService.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/backend/src/core/NoteEditService.ts b/packages/backend/src/core/NoteEditService.ts index acf916983..1901f2db7 100644 --- a/packages/backend/src/core/NoteEditService.ts +++ b/packages/backend/src/core/NoteEditService.ts @@ -438,7 +438,11 @@ export class NoteEditService implements OnApplicationShutdown { userHost: user.host, }); - await transactionalEntityManager.update(MiPoll, oldnote.id, poll); + if (!oldnote.hasPoll) { + await transactionalEntityManager.insert(MiPoll, poll); + } else { + await transactionalEntityManager.update(MiPoll, oldnote.id, poll); + } }); } else { await this.notesRepository.update(oldnote.id, note);