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
This commit is contained in:
Reinaldo Neto 2024-01-31 16:06:07 -03:00 committed by GitHub
parent 39f8a92059
commit cc7d0893e7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 0 deletions

View File

@ -136,6 +136,9 @@ export default async function updateMessages({
try { try {
return message.prepareUpdate( return message.prepareUpdate(
protectedFunction((m: TMessageModel) => { protectedFunction((m: TMessageModel) => {
if (newMessage && !newMessage?.blocks) {
newMessage.blocks = null;
}
Object.assign(m, newMessage); Object.assign(m, newMessage);
}) })
); );
@ -160,6 +163,9 @@ export default async function updateMessages({
try { try {
return threadMessage.prepareUpdate( return threadMessage.prepareUpdate(
protectedFunction((tm: TThreadMessageModel) => { protectedFunction((tm: TThreadMessageModel) => {
if (newThreadMessage && !newThreadMessage?.blocks) {
newThreadMessage.blocks = null;
}
Object.assign(tm, newThreadMessage); Object.assign(tm, newThreadMessage);
if (threadMessage.tmid) { if (threadMessage.tmid) {
tm.rid = threadMessage.tmid; tm.rid = threadMessage.tmid;