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

View file

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