From 2d6f13a8c5f8391a64c28106975bca6de2e68537 Mon Sep 17 00:00:00 2001 From: Scott Nonnenberg Date: Mon, 19 Dec 2022 11:11:04 -0800 Subject: [PATCH] ViewSyncs: Save message after modifying it --- ts/messageModifiers/ViewSyncs.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ts/messageModifiers/ViewSyncs.ts b/ts/messageModifiers/ViewSyncs.ts index 21838542a..4a5a3cba6 100644 --- a/ts/messageModifiers/ViewSyncs.ts +++ b/ts/messageModifiers/ViewSyncs.ts @@ -90,8 +90,10 @@ export class ViewSyncs extends Collection { notificationService.removeBy({ messageId: found.id }); const message = window.MessageController.register(found.id, found); + let didChangeMessage = false; if (message.get('readStatus') !== ReadStatus.Viewed) { + didChangeMessage = true; message.set(markViewed(message.attributes, sync.get('viewedAt'))); const attachments = message.get('attachments'); @@ -102,6 +104,7 @@ export class ViewSyncs extends Collection { const giftBadge = message.get('giftBadge'); if (giftBadge) { + didChangeMessage = true; message.set({ giftBadge: { ...giftBadge, @@ -112,6 +115,10 @@ export class ViewSyncs extends Collection { }); } + if (didChangeMessage) { + window.Signal.Util.queueUpdateMessage(message.attributes); + } + this.remove(sync); } catch (error) { log.error('ViewSyncs.onSync error:', Errors.toLogFormat(error));