From eaa359570cb0bae8ad50f15025b4177829f15c9d Mon Sep 17 00:00:00 2001 From: Rohit Bansal <40559587+Rohit3523@users.noreply.github.com> Date: Sat, 18 Oct 2025 03:38:43 +0530 Subject: [PATCH 1/3] if message is e2e, update attachment data with local data --- app/lib/methods/subscriptions/room.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app/lib/methods/subscriptions/room.ts b/app/lib/methods/subscriptions/room.ts index 004d55cecdc..c2569aac82d 100644 --- a/app/lib/methods/subscriptions/room.ts +++ b/app/lib/methods/subscriptions/room.ts @@ -261,10 +261,21 @@ export default class RoomSubscription { try { const messageRecord = await getMessageById(message._id); if (messageRecord) { + if(messageRecord.t === 'e2e' && message.attachments) { + message.attachments = message.attachments?.map((att) => { + const existing = messageRecord.attachments?.find((a) => a.image_url === att.image_url || a.video_url === att.video_url || a.audio_url === att.audio_url || a.thumb_url === att.thumb_url); + + return { + ...att, + e2e: existing?.e2e, + title_link: existing?.e2e === 'done' ? existing?.title_link : att.title_link + } + }); + } batch.push( messageRecord.prepareUpdate( protectedFunction((m: TMessageModel) => { - Object.assign(m, message); + Object.assign(m, message); }) ) ); From f84deeef5176b2e64fcc011bafd76b9fc1c81af8 Mon Sep 17 00:00:00 2001 From: Rohit3523 Date: Fri, 17 Oct 2025 22:09:47 +0000 Subject: [PATCH 2/3] chore: format code with Prettier [skip ci] --- app/lib/methods/subscriptions/room.ts | 30 ++++++++++++++++----------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/app/lib/methods/subscriptions/room.ts b/app/lib/methods/subscriptions/room.ts index c2569aac82d..5a7e0161731 100644 --- a/app/lib/methods/subscriptions/room.ts +++ b/app/lib/methods/subscriptions/room.ts @@ -261,21 +261,27 @@ export default class RoomSubscription { try { const messageRecord = await getMessageById(message._id); if (messageRecord) { - if(messageRecord.t === 'e2e' && message.attachments) { - message.attachments = message.attachments?.map((att) => { - const existing = messageRecord.attachments?.find((a) => a.image_url === att.image_url || a.video_url === att.video_url || a.audio_url === att.audio_url || a.thumb_url === att.thumb_url); - - return { - ...att, - e2e: existing?.e2e, - title_link: existing?.e2e === 'done' ? existing?.title_link : att.title_link - } - }); - } + if (messageRecord.t === 'e2e' && message.attachments) { + message.attachments = message.attachments?.map(att => { + const existing = messageRecord.attachments?.find( + a => + a.image_url === att.image_url || + a.video_url === att.video_url || + a.audio_url === att.audio_url || + a.thumb_url === att.thumb_url + ); + + return { + ...att, + e2e: existing?.e2e, + title_link: existing?.e2e === 'done' ? existing?.title_link : att.title_link + }; + }); + } batch.push( messageRecord.prepareUpdate( protectedFunction((m: TMessageModel) => { - Object.assign(m, message); + Object.assign(m, message); }) ) ); From 1bc3615551dc705516fdb5527c9d49c65961e62c Mon Sep 17 00:00:00 2001 From: Rohit Bansal <40559587+Rohit3523@users.noreply.github.com> Date: Sun, 19 Oct 2025 01:04:54 +0530 Subject: [PATCH 3/3] make sure prop is present --- app/lib/methods/subscriptions/room.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/lib/methods/subscriptions/room.ts b/app/lib/methods/subscriptions/room.ts index 5a7e0161731..a0ce1310b24 100644 --- a/app/lib/methods/subscriptions/room.ts +++ b/app/lib/methods/subscriptions/room.ts @@ -265,10 +265,10 @@ export default class RoomSubscription { message.attachments = message.attachments?.map(att => { const existing = messageRecord.attachments?.find( a => - a.image_url === att.image_url || - a.video_url === att.video_url || - a.audio_url === att.audio_url || - a.thumb_url === att.thumb_url + (a.image_url && a.image_url === att.image_url) || + (a.video_url && a.video_url === att.video_url) || + (a.audio_url && a.audio_url === att.audio_url) || + (a.thumb_url && a.thumb_url === att.thumb_url) ); return {