Skip to content

Commit

Permalink
Remove redundant listenTo calls in ConversationModel#fetchContacts
Browse files Browse the repository at this point in the history
  • Loading branch information
EvanHahn-Signal committed Mar 29, 2021
1 parent 7a3130a commit 902e48e
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions ts/models/conversations.ts
Expand Up @@ -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,
Expand Down Expand Up @@ -1986,8 +1992,6 @@ export class ConversationModel extends window.Backbone.Model<
}
})
);

this.onMemberVerifiedChange();
}

setVerifiedDefault(options?: VerificationOptions): Promise<unknown> {
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 902e48e

Please sign in to comment.