From 902e48e3086d5b0b235e745bcf66f377f9043d83 Mon Sep 17 00:00:00 2001 From: Evan Hahn <69474926+EvanHahn-Signal@users.noreply.github.com> Date: Mon, 29 Mar 2021 15:43:31 -0500 Subject: [PATCH] Remove redundant listenTo calls in ConversationModel#fetchContacts --- ts/models/conversations.ts | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/ts/models/conversations.ts b/ts/models/conversations.ts index 2dda0323b2da..77bdc13d1591 100644 --- a/ts/models/conversations.ts +++ b/ts/models/conversations.ts @@ -230,6 +230,12 @@ export class ConversationModel extends window.Backbone.Model< this.debouncedUpdateLastMessage, this ); + if (!this.isPrivate()) { + this.contactCollection.on( + 'change:verified', + this.onMemberVerifiedChange.bind(this) + ); + } this.messageCollection = new window.Whisper.MessageCollection([], { conversation: this, @@ -1986,8 +1992,6 @@ export class ConversationModel extends window.Backbone.Model< } }) ); - - this.onMemberVerifiedChange(); } setVerifiedDefault(options?: VerificationOptions): Promise { @@ -4750,14 +4754,7 @@ export class ConversationModel extends window.Backbone.Model< } fetchContacts(): void { - if (this.isPrivate()) { - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - this.contactCollection!.reset([this]); - } const members = this.getMembers(); - window._.forEach(members, member => { - this.listenTo(member, 'change:verified', this.onMemberVerifiedChange); - }); // eslint-disable-next-line @typescript-eslint/no-non-null-assertion this.contactCollection!.reset(members);