From cc7d0893e79098d994f2aaea0ff82b9811d18b50 Mon Sep 17 00:00:00 2001 From: Reinaldo Neto <47038980+reinaldonetof@users.noreply.github.com> Date: Wed, 31 Jan 2024 16:06:07 -0300 Subject: [PATCH] fix: remove blocks when updating an old message (#5522) * fix: remove blocks when updating an old message * minior tweak, add to threadMessagesToUpdate * remove the comments --- app/lib/methods/updateMessages.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/lib/methods/updateMessages.ts b/app/lib/methods/updateMessages.ts index 6acbdce14..c8f9dc2b0 100644 --- a/app/lib/methods/updateMessages.ts +++ b/app/lib/methods/updateMessages.ts @@ -136,6 +136,9 @@ export default async function updateMessages({ try { return message.prepareUpdate( protectedFunction((m: TMessageModel) => { + if (newMessage && !newMessage?.blocks) { + newMessage.blocks = null; + } Object.assign(m, newMessage); }) ); @@ -160,6 +163,9 @@ export default async function updateMessages({ try { return threadMessage.prepareUpdate( protectedFunction((tm: TThreadMessageModel) => { + if (newThreadMessage && !newThreadMessage?.blocks) { + newThreadMessage.blocks = null; + } Object.assign(tm, newThreadMessage); if (threadMessage.tmid) { tm.rid = threadMessage.tmid;