Merge pull request #3978 from matrix-org/jryans/cs-polish

Change new session toast to unverified
This commit is contained in:
J. Ryan Stinnett 2020-01-29 15:33:19 +00:00 committed by GitHub
commit 725ec1dda6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 26 additions and 16 deletions

View File

@ -98,5 +98,9 @@ limitations under the License.
margin: 4px 0 11px 0; margin: 4px 0 11px 0;
font-size: 12px; font-size: 12px;
} }
.mx_Toast_deviceID {
font-size: 10px;
}
} }
} }

View File

@ -21,7 +21,7 @@ import { _t } from './languageHandler';
import ToastStore from './stores/ToastStore'; import ToastStore from './stores/ToastStore';
function toastKey(deviceId) { function toastKey(deviceId) {
return 'newsession_' + deviceId; return 'unverified_session_' + deviceId;
} }
const KEY_BACKUP_POLL_INTERVAL = 5 * 60 * 1000; const KEY_BACKUP_POLL_INTERVAL = 5 * 60 * 1000;
@ -160,10 +160,10 @@ export default class DeviceListener {
this._activeNagToasts.add(device.deviceId); this._activeNagToasts.add(device.deviceId);
ToastStore.sharedInstance().addOrReplaceToast({ ToastStore.sharedInstance().addOrReplaceToast({
key: toastKey(device.deviceId), key: toastKey(device.deviceId),
title: _t("New Session"), title: _t("Unverified session"),
icon: "verification_warning", icon: "verification_warning",
props: {deviceId: device.deviceId}, props: { device },
component: sdk.getComponent("toasts.NewSessionToast"), component: sdk.getComponent("toasts.UnverifiedSessionToast"),
}); });
newActiveToasts.add(device.deviceId); newActiveToasts.add(device.deviceId);
} }

View File

@ -24,21 +24,20 @@ import NewSessionReviewDialog from '../dialogs/NewSessionReviewDialog';
import FormButton from '../elements/FormButton'; import FormButton from '../elements/FormButton';
import { replaceableComponent } from '../../../utils/replaceableComponent'; import { replaceableComponent } from '../../../utils/replaceableComponent';
@replaceableComponent("views.toasts.VerifySessionToast") @replaceableComponent("views.toasts.UnverifiedSessionToast")
export default class VerifySessionToast extends React.PureComponent { export default class UnverifiedSessionToast extends React.PureComponent {
static propTypes = { static propTypes = {
toastKey: PropTypes.string.isRequired, toastKey: PropTypes.string.isRequired,
deviceId: PropTypes.string, device: PropTypes.object.isRequired,
}; };
_onLaterClick = () => { _onLaterClick = () => {
DeviceListener.sharedInstance().dismissVerification(this.props.deviceId); const { device } = this.props;
DeviceListener.sharedInstance().dismissVerification(device.deviceId);
}; };
_onReviewClick = async () => { _onReviewClick = async () => {
const cli = MatrixClientPeg.get(); const { device } = this.props;
const device = await cli.getStoredDevice(cli.getUserId(), this.props.deviceId);
Modal.createTrackedDialog('New Session Review', 'Starting dialog', NewSessionReviewDialog, { Modal.createTrackedDialog('New Session Review', 'Starting dialog', NewSessionReviewDialog, {
userId: MatrixClientPeg.get().getUserId(), userId: MatrixClientPeg.get().getUserId(),
@ -47,8 +46,16 @@ export default class VerifySessionToast extends React.PureComponent {
}; };
render() { render() {
const { device } = this.props;
return (<div> return (<div>
<div className="mx_Toast_description">{_t("Review & verify your new session")}</div> <div className="mx_Toast_description">
<span className="mx_Toast_deviceName">
{device.getDisplayName()}
</span> <span className="mx_Toast_deviceID">
({device.deviceId})
</span>
</div>
<div className="mx_Toast_buttons" aria-live="off"> <div className="mx_Toast_buttons" aria-live="off">
<FormButton label={_t("Later")} kind="danger" onClick={this._onLaterClick} /> <FormButton label={_t("Later")} kind="danger" onClick={this._onLaterClick} />
<FormButton label={_t("Review")} onClick={this._onReviewClick} /> <FormButton label={_t("Review")} onClick={this._onReviewClick} />

View File

@ -91,7 +91,7 @@
"Verify this session": "Verify this session", "Verify this session": "Verify this session",
"Encryption upgrade available": "Encryption upgrade available", "Encryption upgrade available": "Encryption upgrade available",
"Set up encryption": "Set up encryption", "Set up encryption": "Set up encryption",
"New Session": "New Session", "Unverified session": "Unverified session",
"Who would you like to add to this community?": "Who would you like to add to this community?", "Who would you like to add to this community?": "Who would you like to add to this community?",
"Warning: any person you add to a community will be publicly visible to anyone who knows the community ID": "Warning: any person you add to a community will be publicly visible to anyone who knows the community ID", "Warning: any person you add to a community will be publicly visible to anyone who knows the community ID": "Warning: any person you add to a community will be publicly visible to anyone who knows the community ID",
"Invite new community members": "Invite new community members", "Invite new community members": "Invite new community members",
@ -516,13 +516,12 @@
"Headphones": "Headphones", "Headphones": "Headphones",
"Folder": "Folder", "Folder": "Folder",
"Pin": "Pin", "Pin": "Pin",
"Review & verify your new session": "Review & verify your new session",
"Later": "Later",
"Review": "Review",
"Verify your other devices easier": "Verify your other devices easier", "Verify your other devices easier": "Verify your other devices easier",
"Other users may not trust it": "Other users may not trust it", "Other users may not trust it": "Other users may not trust it",
"Upgrade": "Upgrade", "Upgrade": "Upgrade",
"Verify": "Verify", "Verify": "Verify",
"Later": "Later",
"Review": "Review",
"Decline (%(counter)s)": "Decline (%(counter)s)", "Decline (%(counter)s)": "Decline (%(counter)s)",
"Accept <policyLink /> to continue:": "Accept <policyLink /> to continue:", "Accept <policyLink /> to continue:": "Accept <policyLink /> to continue:",
"Upload": "Upload", "Upload": "Upload",