Show sender and device number in decryption error toast

This commit is contained in:
Scott Nonnenberg 2021-12-06 16:21:30 -08:00 committed by GitHub
parent 01549b11d1
commit b1ebc0f483
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 52 additions and 12 deletions

11
.gitignore vendored
View File

@ -11,7 +11,7 @@ config/local-*.json
release/ release/
/dev-app-update.yml /dev-app-update.yml
.nyc_output/ .nyc_output/
*.sublime*
/sql/ /sql/
/start.sh /start.sh
.eslintcache .eslintcache
@ -24,6 +24,9 @@ libtextsecure/components.js
libtextsecure/test/test.js libtextsecure/test/test.js
stylesheets/*.css stylesheets/*.css
test/test.js test/test.js
/storybook-static/
preload.bundle.*
ts/sql/mainWorker.bundle.js.LICENSE.txt
# React / TypeScript # React / TypeScript
app/*.js app/*.js
@ -37,7 +40,7 @@ sticker-creator/**/*.js
# Sticker Creator # Sticker Creator
sticker-creator/dist/* sticker-creator/dist/*
# Editors
/.idea /.idea
/storybook-static/ /.vscode
preload.bundle.* *.sublime*
ts/sql/mainWorker.bundle.js.LICENSE.txt

View File

@ -623,7 +623,7 @@
"message": "Thumbnail link preview for $domain$", "message": "Thumbnail link preview for $domain$",
"description": "Shown while Signal Desktop is fetching metadata for a url in composition area", "description": "Shown while Signal Desktop is fetching metadata for a url in composition area",
"placeholders": { "placeholders": {
"path": { "domain": {
"content": "$1", "content": "$1",
"example": "instagram.com" "example": "instagram.com"
} }
@ -640,8 +640,18 @@
} }
}, },
"decryptionErrorToast": { "decryptionErrorToast": {
"message": "Desktop ran into a decryption error.", "message": "Desktop ran into a decryption error from $name$, device $deviceId$",
"description": "An error popup when we haven't added an error for decryption error." "description": "An error popup when we haven't added an in-timeline error for decryption error, only for beta/internal users.",
"placeholders": {
"name": {
"content": "$1",
"example": "John"
},
"deviceId": {
"content": "$1",
"example": "2"
}
}
}, },
"decryptionErrorToastAction": { "decryptionErrorToastAction": {
"message": "Submit log", "message": "Submit log",

View File

@ -17,6 +17,7 @@
text-align: center; text-align: center;
transform: translate(-50%, 0); transform: translate(-50%, 0);
user-select: none; user-select: none;
overflow: hidden;
z-index: $z-index-toast; z-index: $z-index-toast;
@include light-theme { @include light-theme {
@ -34,10 +35,9 @@
&__button { &__button {
@include font-body-2-bold; @include font-body-2-bold;
border-top-right-radius: $border-radius-px;
border-bottom-right-radius: $border-radius-px;
cursor: pointer; cursor: pointer;
padding: 8px 12px; padding: 8px 12px;
white-space: nowrap;
@include light-theme { @include light-theme {
border-left: 1px solid $color-gray-65; border-left: 1px solid $color-gray-65;
@ -46,6 +46,8 @@
border-left: 1px solid $color-gray-60; border-left: 1px solid $color-gray-60;
} }
outline: none;
&:hover { &:hover {
@include light-theme { @include light-theme {
background-color: $color-gray-65; background-color: $color-gray-65;
@ -54,5 +56,13 @@
background-color: $color-gray-60; background-color: $color-gray-60;
} }
} }
&:focus {
@include keyboard-mode {
background-color: $color-gray-65;
}
@include dark-keyboard-mode {
background-color: $color-gray-60;
}
}
} }
} }

View File

@ -12,7 +12,9 @@ import enMessages from '../../_locales/en/messages.json';
const i18n = setupI18n('en', enMessages); const i18n = setupI18n('en', enMessages);
const defaultProps = { const defaultProps = {
deviceId: 3,
i18n, i18n,
name: 'Someone Somewhere',
onClose: action('onClose'), onClose: action('onClose'),
onShowDebugLog: action('onShowDebugLog'), onShowDebugLog: action('onShowDebugLog'),
}; };

View File

@ -6,6 +6,8 @@ import type { LocalizerType } from '../types/Util';
import { Toast } from './Toast'; import { Toast } from './Toast';
export type ToastPropsType = { export type ToastPropsType = {
deviceId: number;
name: string;
onShowDebugLog: () => unknown; onShowDebugLog: () => unknown;
}; };
@ -15,7 +17,9 @@ type PropsType = {
} & ToastPropsType; } & ToastPropsType;
export const ToastDecryptionError = ({ export const ToastDecryptionError = ({
deviceId,
i18n, i18n,
name,
onClose, onClose,
onShowDebugLog, onShowDebugLog,
}: PropsType): JSX.Element => { }: PropsType): JSX.Element => {
@ -24,12 +28,16 @@ export const ToastDecryptionError = ({
autoDismissDisabled autoDismissDisabled
className="decryption-error" className="decryption-error"
onClose={onClose} onClose={onClose}
style={{ maxWidth: '500px' }}
toastAction={{ toastAction={{
label: i18n('decryptionErrorToastAction'), label: i18n('decryptionErrorToastAction'),
onClick: onShowDebugLog, onClick: onShowDebugLog,
}} }}
> >
{i18n('decryptionErrorToast')} {i18n('decryptionErrorToast', {
name,
deviceId,
})}
</Toast> </Toast>
); );
}; };

View File

@ -151,13 +151,19 @@ export async function onRetryRequest(event: RetryRequestEvent): Promise<void> {
log.info(`onRetryRequest/${logId}: Resend complete.`); log.info(`onRetryRequest/${logId}: Resend complete.`);
} }
function maybeShowDecryptionToast(logId: string) { function maybeShowDecryptionToast(
logId: string,
name: string,
deviceId: number
) {
if (isProduction(window.getVersion())) { if (isProduction(window.getVersion())) {
return; return;
} }
log.info(`maybeShowDecryptionToast/${logId}: Showing decryption error toast`); log.info(`maybeShowDecryptionToast/${logId}: Showing decryption error toast`);
showToast(ToastDecryptionError, { showToast(ToastDecryptionError, {
deviceId,
name,
onShowDebugLog: () => window.showDebugLog(), onShowDebugLog: () => window.showDebugLog(),
}); });
} }
@ -189,7 +195,8 @@ export async function onDecryptionError(
await conversation.getProfiles(); await conversation.getProfiles();
} }
maybeShowDecryptionToast(logId); const name = conversation.getTitle();
maybeShowDecryptionToast(logId, name, senderDevice);
if ( if (
conversation.get('capabilities')?.senderKey && conversation.get('capabilities')?.senderKey &&