setProfileKey: Introduce 'reason' parameter for improved logging
This commit is contained in:
parent
c2e7f30988
commit
b32dbf2c68
8 changed files with 48 additions and 28 deletions
|
@ -4913,8 +4913,12 @@ export class ConversationModel extends window.Backbone
|
|||
|
||||
async setProfileKey(
|
||||
profileKey: string | undefined,
|
||||
{ viaStorageServiceSync = false } = {}
|
||||
{
|
||||
viaStorageServiceSync = false,
|
||||
reason,
|
||||
}: { viaStorageServiceSync?: boolean; reason: string }
|
||||
): Promise<boolean> {
|
||||
const logId = `setProfileKey(${this.idForLogging()}/${reason})`;
|
||||
const oldProfileKey = this.get('profileKey');
|
||||
|
||||
// profileKey is a string so we can compare it directly
|
||||
|
@ -4922,9 +4926,7 @@ export class ConversationModel extends window.Backbone
|
|||
return false;
|
||||
}
|
||||
|
||||
log.info(
|
||||
`Setting sealedSender to UNKNOWN for conversation ${this.idForLogging()}`
|
||||
);
|
||||
log.info(`${logId}: Profile key changed. Setting sealedSender to UNKNOWN`);
|
||||
this.set({
|
||||
profileKeyCredential: null,
|
||||
profileKeyCredentialExpiration: null,
|
||||
|
@ -4935,10 +4937,7 @@ export class ConversationModel extends window.Backbone
|
|||
// We messaged the contact when it had either phone number or username
|
||||
// title.
|
||||
if (this.get('needsTitleTransition')) {
|
||||
log.info(
|
||||
`setProfileKey(${this.idForLogging()}): adding a ` +
|
||||
'title transition notification'
|
||||
);
|
||||
log.info(`${logId}: adding a title transition notification`);
|
||||
|
||||
const { type, e164, username } = this.attributes;
|
||||
|
||||
|
@ -5040,7 +5039,7 @@ export class ConversationModel extends window.Backbone
|
|||
'deriveProfileKeyVersion: Failed to derive profile key version, ' +
|
||||
'clearing profile key.'
|
||||
);
|
||||
void this.setProfileKey(undefined);
|
||||
void this.setProfileKey(undefined, { reason: 'deriveProfileKeyVersion' });
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue