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
1 changed files with 5 additions and 3 deletions

View File

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