combineContacts: Don't clear conversations to reset lookups

This commit is contained in:
Scott Nonnenberg 2020-07-24 16:52:26 -07:00
parent bab59ba2a1
commit 5a79ed1c60
2 changed files with 25 additions and 19 deletions

View file

@ -366,6 +366,7 @@ export class ConversationController {
// Conflict: If e164 match has no UUID, we merge. We prefer the UUID match.
// Note: no await here, we want to keep this function synchronous
convoUuid.updateE164(e164);
this.combineContacts(convoUuid, convoE164)
.then(() => {
// If the old conversation was currently displayed, we load the new one
@ -537,21 +538,13 @@ export class ConversationController {
'combineContacts: Eliminate old conversation from ConversationController lookups'
);
this._conversations.remove(obsolete);
this.regenerateLookups();
this._conversations.resetLookups();
window.log.warn('combineContacts: Complete!', {
obsolete: obsoleteId,
current: currentId,
});
}
regenerateLookups() {
const models = [...this._conversations.models];
this.reset();
this._conversations.add(models);
// We force the initial fetch to be true
this._initialFetchComplete = true;
}
/**
* Given a groupId and optional additional initialization properties,
* ensures the existence of a group conversation and returns a string