Do not optimistically set active_at & timestamp when sending edit

This commit is contained in:
Josh Perez 2023-06-15 18:48:50 -07:00 committed by GitHub
parent a2a6f207e3
commit e9aa30f5bf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3791,14 +3791,18 @@ export class ConversationModel extends window.Backbone
lastMessageStatus: 'sending' as const, lastMessageStatus: 'sending' as const,
}; };
const isEditMessage = Boolean(message.get('editHistory'));
this.set({ this.set({
...draftProperties, ...draftProperties,
...(enabledProfileSharing ? { profileSharing: true } : {}), ...(enabledProfileSharing ? { profileSharing: true } : {}),
...(dontAddMessage ...(dontAddMessage
? {} ? {}
: this.incrementSentMessageCount({ dry: true })), : this.incrementSentMessageCount({ dry: true })),
active_at: now, // If it's an edit message we don't want to optimistically set the
timestamp: now, // active_at & timestamp to now. We want it to stay the same.
active_at: isEditMessage ? this.get('active_at') : now,
timestamp: isEditMessage ? this.get('timestamp') : now,
...(unarchivedConversation ? { isArchived: false } : {}), ...(unarchivedConversation ? { isArchived: false } : {}),
}); });