Drop extraneous db query

This commit is contained in:
Fedor Indutny 2021-08-26 09:17:57 -07:00 committed by GitHub
parent 598513e037
commit 4c6c869c86
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1573,12 +1573,14 @@ export class ConversationModel extends window.Backbone
window.Signal.Data.updateConversation(this.attributes); window.Signal.Data.updateConversation(this.attributes);
} }
incrementSentMessageCount(): void { incrementSentMessageCount({ save = true }: { save?: boolean } = {}): void {
this.set({ this.set({
messageCount: (this.get('messageCount') || 0) + 1, messageCount: (this.get('messageCount') || 0) + 1,
sentMessageCount: (this.get('sentMessageCount') || 0) + 1, sentMessageCount: (this.get('sentMessageCount') || 0) + 1,
}); });
window.Signal.Data.updateConversation(this.attributes); if (save) {
window.Signal.Data.updateConversation(this.attributes);
}
} }
decrementSentMessageCount(): void { decrementSentMessageCount(): void {
@ -3714,7 +3716,7 @@ export class ConversationModel extends window.Backbone
isArchived: false, isArchived: false,
}); });
this.incrementSentMessageCount(); this.incrementSentMessageCount({ save: false });
const renderDuration = Date.now() - renderStart; const renderDuration = Date.now() - renderStart;