requestResend: Show decryption error toast only for RESENDABLE/DEFAULT

This commit is contained in:
Scott Nonnenberg 2021-08-05 10:25:59 -07:00 committed by GitHub
parent db0c9f0f49
commit 3d8976d030
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 6 deletions

View File

@ -37,7 +37,7 @@ export async function onRetryRequest(event: RetryRequestEvent): Promise<void> {
senderDevice,
sentAt,
} = retryRequest;
const logId = `${requesterUuid}.${requesterDevice} ${sentAt}-${senderDevice}`;
const logId = `${requesterUuid}.${requesterDevice} ${sentAt}.${senderDevice}`;
window.log.info(`onRetryRequest/${logId}: Starting...`);
@ -128,7 +128,9 @@ function maybeShowDecryptionToast(logId: string) {
return;
}
window.log.info(`onDecryptionError/${logId}: Showing decryption error toast`);
window.log.info(
`maybeShowDecryptionToast/${logId}: Showing decryption error toast`
);
window.Whisper.ToastView.show(
window.Whisper.DecryptionErrorToast,
document.getElementsByClassName('conversation-stack')[0]
@ -152,6 +154,8 @@ export async function onDecryptionError(
await conversation.getProfiles();
}
maybeShowDecryptionToast(logId);
if (
conversation.get('capabilities')?.senderKey &&
RemoteConfig.isEnabled('desktop.senderKey.retry')
@ -460,16 +464,15 @@ async function requestResend(decryptionError: DecryptionErrorEventData) {
wasOpened,
});
maybeShowDecryptionToast(logId);
return;
}
// This message cannot be resent. We'll show no error and trust the other side to
// reset their session.
if (contentHint === ContentHint.IMPLICIT) {
maybeShowDecryptionToast(logId);
window.log.info(
`requestResend/${logId}: contentHint is IMPLICIT, doing nothing.`
);
return;
}