ViewSyncs: Save message after modifying it
This commit is contained in:
parent
0613025f95
commit
2d6f13a8c5
1 changed files with 7 additions and 0 deletions
|
@ -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));
|
||||
|
|
Loading…
Reference in a new issue