diff --git a/res/css/structures/_ToastContainer.scss b/res/css/structures/_ToastContainer.scss index 5b5c49f357..d1687743d6 100644 --- a/res/css/structures/_ToastContainer.scss +++ b/res/css/structures/_ToastContainer.scss @@ -98,5 +98,9 @@ limitations under the License. margin: 4px 0 11px 0; font-size: 12px; } + + .mx_Toast_deviceID { + font-size: 10px; + } } } diff --git a/src/DeviceListener.js b/src/DeviceListener.js index 630d1a61c0..4bc6ce2097 100644 --- a/src/DeviceListener.js +++ b/src/DeviceListener.js @@ -21,7 +21,7 @@ import { _t } from './languageHandler'; import ToastStore from './stores/ToastStore'; function toastKey(deviceId) { - return 'newsession_' + deviceId; + return 'unverified_session_' + deviceId; } const KEY_BACKUP_POLL_INTERVAL = 5 * 60 * 1000; @@ -160,10 +160,10 @@ export default class DeviceListener { this._activeNagToasts.add(device.deviceId); ToastStore.sharedInstance().addOrReplaceToast({ key: toastKey(device.deviceId), - title: _t("New Session"), + title: _t("Unverified session"), icon: "verification_warning", - props: {deviceId: device.deviceId}, - component: sdk.getComponent("toasts.NewSessionToast"), + props: { device }, + component: sdk.getComponent("toasts.UnverifiedSessionToast"), }); newActiveToasts.add(device.deviceId); } diff --git a/src/components/views/toasts/NewSessionToast.js b/src/components/views/toasts/UnverifiedSessionToast.js similarity index 72% rename from src/components/views/toasts/NewSessionToast.js rename to src/components/views/toasts/UnverifiedSessionToast.js index 80564f3494..15cf18f47d 100644 --- a/src/components/views/toasts/NewSessionToast.js +++ b/src/components/views/toasts/UnverifiedSessionToast.js @@ -24,21 +24,20 @@ import NewSessionReviewDialog from '../dialogs/NewSessionReviewDialog'; import FormButton from '../elements/FormButton'; import { replaceableComponent } from '../../../utils/replaceableComponent'; -@replaceableComponent("views.toasts.VerifySessionToast") -export default class VerifySessionToast extends React.PureComponent { +@replaceableComponent("views.toasts.UnverifiedSessionToast") +export default class UnverifiedSessionToast extends React.PureComponent { static propTypes = { toastKey: PropTypes.string.isRequired, - deviceId: PropTypes.string, + device: PropTypes.object.isRequired, }; _onLaterClick = () => { - DeviceListener.sharedInstance().dismissVerification(this.props.deviceId); + const { device } = this.props; + DeviceListener.sharedInstance().dismissVerification(device.deviceId); }; _onReviewClick = async () => { - const cli = MatrixClientPeg.get(); - - const device = await cli.getStoredDevice(cli.getUserId(), this.props.deviceId); + const { device } = this.props; Modal.createTrackedDialog('New Session Review', 'Starting dialog', NewSessionReviewDialog, { userId: MatrixClientPeg.get().getUserId(), @@ -47,8 +46,16 @@ export default class VerifySessionToast extends React.PureComponent { }; render() { + const { device } = this.props; + return (