Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Don't download E2E devices if feature disabled #418

Merged
merged 2 commits into from
Aug 17, 2016
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion src/components/views/rooms/MemberInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ module.exports = React.createClass({
},

componentDidMount: function() {
// only display the devices list if our client supports E2E *and* the
// feature is enabled in the user settings
this._enableDevices = MatrixClientPeg.get().isCryptoEnabled() &&
UserSettingsStore.isFeatureEnabled("e2e_encryption");

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be in componentWillMount really, as I think you'll be be testing it and getting undefined on the first render call.

this._updateStateForNewMember(this.props.member);
MatrixClientPeg.get().on("deviceVerificationChanged", this.onDeviceVerificationChanged);
},
Expand Down Expand Up @@ -147,6 +152,10 @@ module.exports = React.createClass({
},

onDeviceVerificationChanged: function(userId, device) {
if (!this._enableDevices) {
return;
}

if (userId == this.props.member.userId) {
// no need to re-download the whole thing; just update our copy of
// the list.
Expand All @@ -170,6 +179,10 @@ module.exports = React.createClass({
},

_downloadDeviceList: function(member) {
if (!this._enableDevices) {
return;
}

var cancelled = false;
this._cancelDeviceList = function() { cancelled = true; }

Expand Down Expand Up @@ -532,7 +545,7 @@ module.exports = React.createClass({
},

_renderDevices: function() {
if (!UserSettingsStore.isFeatureEnabled("e2e_encryption")) {
if (!this._enableDevices) {
return null;
}

Expand Down