Add extra logging for change phone number
This commit is contained in:
parent
bcd9f961ad
commit
8cd557ff91
7 changed files with 59 additions and 14 deletions
|
@ -279,7 +279,12 @@ export class ConversationController {
|
||||||
getOurConversationId(): string | undefined {
|
getOurConversationId(): string | undefined {
|
||||||
const e164 = window.textsecure.storage.user.getNumber();
|
const e164 = window.textsecure.storage.user.getNumber();
|
||||||
const uuid = window.textsecure.storage.user.getUuid()?.toString();
|
const uuid = window.textsecure.storage.user.getUuid()?.toString();
|
||||||
return this.ensureContactIds({ e164, uuid, highTrust: true });
|
return this.ensureContactIds({
|
||||||
|
e164,
|
||||||
|
uuid,
|
||||||
|
highTrust: true,
|
||||||
|
reason: 'getOurConversationId',
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getOurConversationIdOrThrow(): string {
|
getOurConversationIdOrThrow(): string {
|
||||||
|
@ -325,11 +330,20 @@ export class ConversationController {
|
||||||
e164,
|
e164,
|
||||||
uuid,
|
uuid,
|
||||||
highTrust,
|
highTrust,
|
||||||
}: {
|
reason,
|
||||||
e164?: string | null;
|
}:
|
||||||
uuid?: string | null;
|
| {
|
||||||
highTrust?: boolean;
|
e164?: string | null;
|
||||||
}): string | undefined {
|
uuid?: string | null;
|
||||||
|
highTrust?: false;
|
||||||
|
reason?: void;
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
e164?: string | null;
|
||||||
|
uuid?: string | null;
|
||||||
|
highTrust: true;
|
||||||
|
reason: string;
|
||||||
|
}): string | undefined {
|
||||||
// Check for at least one parameter being provided. This is necessary
|
// Check for at least one parameter being provided. This is necessary
|
||||||
// because this path can be called on startup to resolve our own ID before
|
// because this path can be called on startup to resolve our own ID before
|
||||||
// our phone number or UUID are known. The existing behavior in these
|
// our phone number or UUID are known. The existing behavior in these
|
||||||
|
@ -346,7 +360,10 @@ export class ConversationController {
|
||||||
|
|
||||||
// 1. Handle no match at all
|
// 1. Handle no match at all
|
||||||
if (!convoE164 && !convoUuid) {
|
if (!convoE164 && !convoUuid) {
|
||||||
log.info('ensureContactIds: Creating new contact, no matches found');
|
log.info(
|
||||||
|
'ensureContactIds: Creating new contact, no matches found',
|
||||||
|
highTrust ? reason : 'no reason'
|
||||||
|
);
|
||||||
const newConvo = this.getOrCreate(identifier, 'private');
|
const newConvo = this.getOrCreate(identifier, 'private');
|
||||||
if (highTrust && e164) {
|
if (highTrust && e164) {
|
||||||
newConvo.updateE164(e164);
|
newConvo.updateE164(e164);
|
||||||
|
@ -375,7 +392,10 @@ export class ConversationController {
|
||||||
// Fill in the UUID for an e164-only contact
|
// Fill in the UUID for an e164-only contact
|
||||||
if (normalizedUuid && !convoE164.get('uuid')) {
|
if (normalizedUuid && !convoE164.get('uuid')) {
|
||||||
if (highTrust) {
|
if (highTrust) {
|
||||||
log.info('ensureContactIds: Adding UUID to e164-only match');
|
log.info(
|
||||||
|
`ensureContactIds: Adding UUID (${uuid}) to e164-only match ` +
|
||||||
|
`(${e164}), reason: ${reason}`
|
||||||
|
);
|
||||||
convoE164.updateUuid(normalizedUuid);
|
convoE164.updateUuid(normalizedUuid);
|
||||||
updateConversation(convoE164.attributes);
|
updateConversation(convoE164.attributes);
|
||||||
}
|
}
|
||||||
|
@ -389,7 +409,10 @@ export class ConversationController {
|
||||||
const newConvo = this.getOrCreate(normalizedUuid, 'private');
|
const newConvo = this.getOrCreate(normalizedUuid, 'private');
|
||||||
|
|
||||||
if (highTrust) {
|
if (highTrust) {
|
||||||
log.info('ensureContactIds: Moving e164 from old contact to new');
|
log.info(
|
||||||
|
`ensureContactIds: Moving e164 (${e164}) from old contact ` +
|
||||||
|
`(${convoE164.get('uuid')}) to new (${uuid}), reason: ${reason}`
|
||||||
|
);
|
||||||
|
|
||||||
// Remove the e164 from the old contact...
|
// Remove the e164 from the old contact...
|
||||||
convoE164.set({ e164: undefined });
|
convoE164.set({ e164: undefined });
|
||||||
|
@ -406,7 +429,10 @@ export class ConversationController {
|
||||||
}
|
}
|
||||||
if (!convoE164 && convoUuid) {
|
if (!convoE164 && convoUuid) {
|
||||||
if (e164 && highTrust) {
|
if (e164 && highTrust) {
|
||||||
log.info('ensureContactIds: Adding e164 to UUID-only match');
|
log.info(
|
||||||
|
`ensureContactIds: Adding e164 (${e164}) to UUID-only match ` +
|
||||||
|
`(${uuid}), reason: ${reason}`
|
||||||
|
);
|
||||||
convoUuid.updateE164(e164);
|
convoUuid.updateE164(e164);
|
||||||
updateConversation(convoUuid.attributes);
|
updateConversation(convoUuid.attributes);
|
||||||
}
|
}
|
||||||
|
@ -429,7 +455,9 @@ export class ConversationController {
|
||||||
// Conflict: If e164 match already has a UUID, we remove its e164.
|
// Conflict: If e164 match already has a UUID, we remove its e164.
|
||||||
if (convoE164.get('uuid') && convoE164.get('uuid') !== normalizedUuid) {
|
if (convoE164.get('uuid') && convoE164.get('uuid') !== normalizedUuid) {
|
||||||
log.info(
|
log.info(
|
||||||
'ensureContactIds: e164 match had different UUID than incoming pair, removing its e164.'
|
`ensureContactIds: e164 match (${e164}) had different ` +
|
||||||
|
`UUID(${convoE164.get('uuid')}) than incoming pair (${uuid}), ` +
|
||||||
|
`removing its e164, reason: ${reason}`
|
||||||
);
|
);
|
||||||
|
|
||||||
// Remove the e164 from the old contact...
|
// Remove the e164 from the old contact...
|
||||||
|
|
|
@ -2467,6 +2467,7 @@ export async function startApp(): Promise<void> {
|
||||||
e164: sender,
|
e164: sender,
|
||||||
uuid: senderUuid,
|
uuid: senderUuid,
|
||||||
highTrust: true,
|
highTrust: true,
|
||||||
|
reason: `onTyping(${typing.timestamp})`,
|
||||||
});
|
});
|
||||||
|
|
||||||
// We multiplex between GV1/GV2 groups here, but we don't kick off migrations
|
// We multiplex between GV1/GV2 groups here, but we don't kick off migrations
|
||||||
|
@ -2607,6 +2608,7 @@ export async function startApp(): Promise<void> {
|
||||||
e164: details.number,
|
e164: details.number,
|
||||||
uuid: details.uuid,
|
uuid: details.uuid,
|
||||||
highTrust: true,
|
highTrust: true,
|
||||||
|
reason: 'onContactReceived',
|
||||||
});
|
});
|
||||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||||
const conversation = window.ConversationController.get(detailsId)!;
|
const conversation = window.ConversationController.get(detailsId)!;
|
||||||
|
@ -2835,6 +2837,7 @@ export async function startApp(): Promise<void> {
|
||||||
e164: envelope.source,
|
e164: envelope.source,
|
||||||
uuid: envelope.sourceUuid,
|
uuid: envelope.sourceUuid,
|
||||||
highTrust: true,
|
highTrust: true,
|
||||||
|
reason: `onEnvelopeReceived(${envelope.timestamp})`,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2970,6 +2973,7 @@ export async function startApp(): Promise<void> {
|
||||||
e164: data.source,
|
e164: data.source,
|
||||||
uuid: data.sourceUuid,
|
uuid: data.sourceUuid,
|
||||||
highTrust: true,
|
highTrust: true,
|
||||||
|
reason: 'onProfileKeyUpdate',
|
||||||
});
|
});
|
||||||
const conversation = window.ConversationController.get(conversationId);
|
const conversation = window.ConversationController.get(conversationId);
|
||||||
|
|
||||||
|
@ -3055,6 +3059,7 @@ export async function startApp(): Promise<void> {
|
||||||
uuid: destinationUuid,
|
uuid: destinationUuid,
|
||||||
e164: destination,
|
e164: destination,
|
||||||
highTrust: true,
|
highTrust: true,
|
||||||
|
reason: `unidentifiedStatus(${timestamp})`,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
if (!conversationId || conversationId === ourId) {
|
if (!conversationId || conversationId === ourId) {
|
||||||
|
@ -3187,6 +3192,7 @@ export async function startApp(): Promise<void> {
|
||||||
e164: source,
|
e164: source,
|
||||||
uuid: sourceUuid,
|
uuid: sourceUuid,
|
||||||
highTrust: true,
|
highTrust: true,
|
||||||
|
reason: `getMessageDescriptor(${message.timestamp}): group v1`,
|
||||||
});
|
});
|
||||||
|
|
||||||
const conversationId = window.ConversationController.ensureGroup(id, {
|
const conversationId = window.ConversationController.ensureGroup(id, {
|
||||||
|
@ -3203,6 +3209,7 @@ export async function startApp(): Promise<void> {
|
||||||
e164: destination,
|
e164: destination,
|
||||||
uuid: destinationUuid,
|
uuid: destinationUuid,
|
||||||
highTrust: true,
|
highTrust: true,
|
||||||
|
reason: `getMessageDescriptor(${message.timestamp}): private`,
|
||||||
});
|
});
|
||||||
if (!id) {
|
if (!id) {
|
||||||
confirm();
|
confirm();
|
||||||
|
@ -3609,6 +3616,7 @@ export async function startApp(): Promise<void> {
|
||||||
e164: source,
|
e164: source,
|
||||||
uuid: sourceUuid,
|
uuid: sourceUuid,
|
||||||
highTrust: true,
|
highTrust: true,
|
||||||
|
reason: `onReadOrViewReceipt(${envelopeTimestamp})`,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
log.info(
|
log.info(
|
||||||
|
@ -3775,6 +3783,7 @@ export async function startApp(): Promise<void> {
|
||||||
e164,
|
e164,
|
||||||
uuid,
|
uuid,
|
||||||
highTrust: true,
|
highTrust: true,
|
||||||
|
reason: 'onVerified',
|
||||||
});
|
});
|
||||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||||
const contact = window.ConversationController.get(verifiedId)!;
|
const contact = window.ConversationController.get(verifiedId)!;
|
||||||
|
@ -3805,6 +3814,7 @@ export async function startApp(): Promise<void> {
|
||||||
e164: source,
|
e164: source,
|
||||||
uuid: sourceUuid,
|
uuid: sourceUuid,
|
||||||
highTrust: true,
|
highTrust: true,
|
||||||
|
reason: `onDeliveryReceipt(${envelopeTimestamp})`,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -1870,7 +1870,7 @@ export class ConversationModel extends window.Backbone
|
||||||
this.set('e164', e164);
|
this.set('e164', e164);
|
||||||
|
|
||||||
if (oldValue) {
|
if (oldValue) {
|
||||||
this.addChangeNumberNotification();
|
this.addChangeNumberNotification(oldValue, e164);
|
||||||
}
|
}
|
||||||
|
|
||||||
window.Signal.Data.updateConversation(this.attributes);
|
window.Signal.Data.updateConversation(this.attributes);
|
||||||
|
@ -3220,7 +3220,10 @@ export class ConversationModel extends window.Backbone
|
||||||
this.set('pendingUniversalTimer', undefined);
|
this.set('pendingUniversalTimer', undefined);
|
||||||
}
|
}
|
||||||
|
|
||||||
async addChangeNumberNotification(): Promise<void> {
|
async addChangeNumberNotification(
|
||||||
|
oldValue: string,
|
||||||
|
newValue: string
|
||||||
|
): Promise<void> {
|
||||||
const sourceUuid = this.getCheckedUuid(
|
const sourceUuid = this.getCheckedUuid(
|
||||||
'Change number notification without uuid'
|
'Change number notification without uuid'
|
||||||
);
|
);
|
||||||
|
@ -3236,7 +3239,7 @@ export class ConversationModel extends window.Backbone
|
||||||
|
|
||||||
log.info(
|
log.info(
|
||||||
`Conversation ${this.idForLogging()}: adding change number ` +
|
`Conversation ${this.idForLogging()}: adding change number ` +
|
||||||
`notification for ${sourceUuid.toString()}`
|
`notification for ${sourceUuid.toString()} from ${oldValue} to ${newValue}`
|
||||||
);
|
);
|
||||||
|
|
||||||
const convos = [
|
const convos = [
|
||||||
|
|
|
@ -2247,6 +2247,7 @@ export class MessageModel extends window.Backbone.Model<MessageAttributesType> {
|
||||||
uuid: destinationUuid,
|
uuid: destinationUuid,
|
||||||
e164: destination,
|
e164: destination,
|
||||||
highTrust: true,
|
highTrust: true,
|
||||||
|
reason: `handleDataMessage(${initialMessage.timestamp})`,
|
||||||
});
|
});
|
||||||
if (!destinationConversationId) {
|
if (!destinationConversationId) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -770,6 +770,7 @@ export async function mergeContactRecord(
|
||||||
e164,
|
e164,
|
||||||
uuid,
|
uuid,
|
||||||
highTrust: true,
|
highTrust: true,
|
||||||
|
reason: 'mergeContactRecord',
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!id) {
|
if (!id) {
|
||||||
|
|
|
@ -604,6 +604,7 @@ export default class AccountManager extends EventTarget {
|
||||||
e164: number,
|
e164: number,
|
||||||
uuid: ourUuid,
|
uuid: ourUuid,
|
||||||
highTrust: true,
|
highTrust: true,
|
||||||
|
reason: 'createAccount',
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!conversationId) {
|
if (!conversationId) {
|
||||||
|
|
|
@ -43,6 +43,7 @@ export async function updateConversationsWithUuidLookup({
|
||||||
e164,
|
e164,
|
||||||
uuid: uuidFromServer,
|
uuid: uuidFromServer,
|
||||||
highTrust: true,
|
highTrust: true,
|
||||||
|
reason: 'updateConversationsWithUuidLookup',
|
||||||
});
|
});
|
||||||
const maybeFinalConversation =
|
const maybeFinalConversation =
|
||||||
conversationController.get(finalConversationId);
|
conversationController.get(finalConversationId);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue