Skip to content

Commit

Permalink
recentMedia/lightbox: Register messages for update and for lightbox
Browse files Browse the repository at this point in the history
  • Loading branch information
scottnonnenberg-signal committed Nov 4, 2022
1 parent 4445ef8 commit 38c6a87
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions ts/views/conversation_view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1293,13 +1293,20 @@ export class ConversationView extends window.Backbone.View<ConversationModel> {
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
) {
// 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 });
}
Expand Down

0 comments on commit 38c6a87

Please sign in to comment.