From 071e364be29cfafab94bf0442370fa0a955f3197 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Sat, 21 Jan 2017 17:56:48 +0000 Subject: [PATCH] improve the verify warning if blacklisting is unabled --- src/Resend.js | 3 ++- src/components/views/dialogs/UnknownDeviceDialog.js | 12 +++++++++++- src/components/views/rooms/MessageComposerInput.js | 3 ++- .../views/rooms/MessageComposerInputOld.js | 3 ++- 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/Resend.js b/src/Resend.js index e67c812b7c..21da1c173b 100644 --- a/src/Resend.js +++ b/src/Resend.js @@ -32,7 +32,8 @@ module.exports = { if (err.name === "UnknownDeviceError") { var UnknownDeviceDialog = sdk.getComponent("dialogs.UnknownDeviceDialog"); Modal.createDialog(UnknownDeviceDialog, { - devices: err.devices + devices: err.devices, + room: MatrixClientPeg.get().getRoom(event.getRoomId()), }); } diff --git a/src/components/views/dialogs/UnknownDeviceDialog.js b/src/components/views/dialogs/UnknownDeviceDialog.js index 8e04414b9c..bd23427d2b 100644 --- a/src/components/views/dialogs/UnknownDeviceDialog.js +++ b/src/components/views/dialogs/UnknownDeviceDialog.js @@ -22,6 +22,7 @@ module.exports = React.createClass({ displayName: 'UnknownEventDialog', propTypes: { + room: React.PropTypes.object.isRequired, devices: React.PropTypes.object.isRequired, onFinished: React.PropTypes.func.isRequired, }, @@ -35,6 +36,15 @@ module.exports = React.createClass({ }, render: function() { + var client = MatrixClientPeg.get(); + var warning; + if (client.getGlobalBlacklistUnverifiedDevices() || room.getBlacklistUnverifiedDevices()) { + warning =

You are currently blacklisting unverified devices; to send messages to these devices you must verify them.

; + } + else { + warning =

We strongly recommend you verify them before continuing.

; + } + return (
@@ -42,7 +52,7 @@ module.exports = React.createClass({

This room contains unknown devices which have not been verified.

-

We strongly recommend you verify them before continuing.

+ { warning }

Unknown devices:

    { Object.keys(this.props.devices).map(userId=>{ diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index 4a6e36b854..54e4894adf 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -561,7 +561,8 @@ export default class MessageComposerInput extends React.Component { if (err.name === "UnknownDeviceError") { var UnknownDeviceDialog = sdk.getComponent("dialogs.UnknownDeviceDialog"); Modal.createDialog(UnknownDeviceDialog, { - devices: err.devices + devices: err.devices, + room: this.props.room, }); } dis.dispatch({ diff --git a/src/components/views/rooms/MessageComposerInputOld.js b/src/components/views/rooms/MessageComposerInputOld.js index a5b1f6b786..7fd3e0b427 100644 --- a/src/components/views/rooms/MessageComposerInputOld.js +++ b/src/components/views/rooms/MessageComposerInputOld.js @@ -345,7 +345,8 @@ module.exports = React.createClass({ if (err.name === "UnknownDeviceError") { var UnknownDeviceDialog = sdk.getComponent("dialogs.UnknownDeviceDialog"); Modal.createDialog(UnknownDeviceDialog, { - devices: err.devices + devices: err.devices, + room: this.props.room, }); }