ViewSyncs: Save message after modifying it
This commit is contained in:
@@ -90,8 +90,10 @@ export class ViewSyncs extends Collection {
|
|||||||
notificationService.removeBy({ messageId: found.id });
|
notificationService.removeBy({ messageId: found.id });
|
||||||
|
|
||||||
const message = window.MessageController.register(found.id, found);
|
const message = window.MessageController.register(found.id, found);
|
||||||
|
let didChangeMessage = false;
|
||||||
|
|
||||||
if (message.get('readStatus') !== ReadStatus.Viewed) {
|
if (message.get('readStatus') !== ReadStatus.Viewed) {
|
||||||
|
didChangeMessage = true;
|
||||||
message.set(markViewed(message.attributes, sync.get('viewedAt')));
|
message.set(markViewed(message.attributes, sync.get('viewedAt')));
|
||||||
|
|
||||||
const attachments = message.get('attachments');
|
const attachments = message.get('attachments');
|
||||||
@@ -102,6 +104,7 @@ export class ViewSyncs extends Collection {
|
|||||||
|
|
||||||
const giftBadge = message.get('giftBadge');
|
const giftBadge = message.get('giftBadge');
|
||||||
if (giftBadge) {
|
if (giftBadge) {
|
||||||
|
didChangeMessage = true;
|
||||||
message.set({
|
message.set({
|
||||||
giftBadge: {
|
giftBadge: {
|
||||||
...giftBadge,
|
...giftBadge,
|
||||||
@@ -112,6 +115,10 @@ export class ViewSyncs extends Collection {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (didChangeMessage) {
|
||||||
|
window.Signal.Util.queueUpdateMessage(message.attributes);
|
||||||
|
}
|
||||||
|
|
||||||
this.remove(sync);
|
this.remove(sync);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
log.error('ViewSyncs.onSync error:', Errors.toLogFormat(error));
|
log.error('ViewSyncs.onSync error:', Errors.toLogFormat(error));
|
||||||
|
Reference in New Issue
Block a user