From 38c6a872f476cbe464d3d6939e742f6d8380eb67 Mon Sep 17 00:00:00 2001 From: Scott Nonnenberg Date: Fri, 4 Nov 2022 13:32:29 -0700 Subject: [PATCH] recentMedia/lightbox: Register messages for update and for lightbox --- ts/views/conversation_view.tsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ts/views/conversation_view.tsx b/ts/views/conversation_view.tsx index 6970a2263b86..07eb6d8c1112 100644 --- a/ts/views/conversation_view.tsx +++ b/ts/views/conversation_view.tsx @@ -1293,6 +1293,11 @@ export class ConversationView extends window.Backbone.View { const message = rawMedia[i]; const { schemaVersion } = message; + // We want these message to be cached in memory for other operations like + // listening to 'expired' events when showing the lightbox, and so any other + // code working with this message has the latest updates. + const model = window.MessageController.register(message.id, message); + if ( schemaVersion && schemaVersion < Message.VERSION_NEEDED_FOR_DISPLAY @@ -1300,6 +1305,8 @@ export class ConversationView extends window.Backbone.View { // Yep, we really do want to wait for each of these // eslint-disable-next-line no-await-in-loop rawMedia[i] = await upgradeMessageSchema(message); + model.set(rawMedia[i]); + // eslint-disable-next-line no-await-in-loop await window.Signal.Data.saveMessage(rawMedia[i], { ourUuid }); }