diff --git a/src/components/structures/RoomView.js b/src/components/structures/RoomView.js index acdea38c69..940c96b640 100644 --- a/src/components/structures/RoomView.js +++ b/src/components/structures/RoomView.js @@ -493,10 +493,40 @@ module.exports = React.createClass({ // called when state.room is first initialised (either at initial load, // after a successful peek, or after we join the room). _onRoomLoaded: function(room) { + this._warnAboutEncryption(room); this._calculatePeekRules(room); this._updatePreviewUrlVisibility(room); }, + _warnAboutEncryption: function (room) { + if (!MatrixClientPeg.get().isRoomEncrypted(room.roomId)) { + return; + } + let userHasUsedEncryption = false; + if (localStorage) { + userHasUsedEncryption = localStorage.getItem('mx_user_has_used_encryption'); + } + if (!userHasUsedEncryption) { + var QuestionDialog = sdk.getComponent("dialogs.QuestionDialog"); + Modal.createDialog(QuestionDialog, { + title: "Warning!", + hasCancelButton: false, + description: ( +
+

End-to-end encryption is in beta and may not be reliable.

+

You should not yet trust it to secure data.

+

Devices will not yet be able to decrypt history from before they joined the room.

+

Once encryption is enabled for a room it cannot be turned off again (for now).

+

Encrypted messages will not be visible on clients that do not yet implement encryption.

+
+ ), + }); + } + if (localStorage) { + localStorage.setItem('mx_user_has_used_encryption', true); + } + }, + _calculatePeekRules: function(room) { var guestAccessEvent = room.currentState.getStateEvents("m.room.guest_access", ""); if (guestAccessEvent && guestAccessEvent.getContent().guest_access === "can_join") { diff --git a/src/components/views/dialogs/QuestionDialog.js b/src/components/views/dialogs/QuestionDialog.js index 3f7f237c30..0260fc29e2 100644 --- a/src/components/views/dialogs/QuestionDialog.js +++ b/src/components/views/dialogs/QuestionDialog.js @@ -36,6 +36,7 @@ export default React.createClass({ description: "", button: "OK", focus: true, + hasCancelButton: true, }; }, @@ -49,6 +50,11 @@ export default React.createClass({ render: function() { const BaseDialog = sdk.getComponent('views.dialogs.BaseDialog'); + const cancelButton = this.props.hasCancelButton ? ( + + ) : null; return ( {this.props.button} - - + {cancelButton} );