Skip to content

Commit 5585f5d

Browse files
authored
fix: e2ee attachment getting locked after interaction (#6735)
1 parent 4185c60 commit 5585f5d

File tree

1 file changed

+17
-0
lines changed
  • app/lib/methods/subscriptions

1 file changed

+17
-0
lines changed

app/lib/methods/subscriptions/room.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,23 @@ export default class RoomSubscription {
261261
try {
262262
const messageRecord = await getMessageById(message._id);
263263
if (messageRecord) {
264+
if (messageRecord.t === 'e2e' && message.attachments) {
265+
message.attachments = message.attachments?.map(att => {
266+
const existing = messageRecord.attachments?.find(
267+
a =>
268+
(a.image_url && a.image_url === att.image_url) ||
269+
(a.video_url && a.video_url === att.video_url) ||
270+
(a.audio_url && a.audio_url === att.audio_url) ||
271+
(a.thumb_url && a.thumb_url === att.thumb_url)
272+
);
273+
274+
return {
275+
...att,
276+
e2e: existing?.e2e,
277+
title_link: existing?.e2e === 'done' ? existing?.title_link : att.title_link
278+
};
279+
});
280+
}
264281
batch.push(
265282
messageRecord.prepareUpdate(
266283
protectedFunction((m: TMessageModel) => {

0 commit comments

Comments
 (0)