Clean up conversations with UUID as E164

This commit is contained in:
Fedor Indutny 2021-07-13 17:46:02 -07:00 committed by GitHub
parent a22dcc986f
commit 8951665554
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 11 deletions

View file

@ -13,6 +13,7 @@ import { SendOptionsType, CallbackResultType } from './textsecure/SendMessage';
import { ConversationModel } from './models/conversations';
import { maybeDeriveGroupV2Id } from './groups';
import { assert } from './util/assert';
import { isValidGuid } from './util/isValidGuid';
import { map, reduce } from './util/iterables';
import { isGroupV1, isGroupV2 } from './util/whatTypeOfConversation';
import { deprecated } from './util/deprecated';
@ -843,6 +844,18 @@ export class ConversationController {
});
updateConversation(conversation.attributes);
}
// Clean up the conversations that have UUID as their e164.
const e164 = conversation.get('e164');
const uuid = conversation.get('uuid');
if (isValidGuid(e164) && uuid) {
conversation.set({ e164: undefined });
updateConversation(conversation.attributes);
window.log.info(
`Cleaning up conversation(${uuid}) with invalid e164`
);
}
} catch (error) {
window.log.error(
'ConversationController.load/map: Failed to prepare a conversation',