From b75be41f94a3c63250cb853698b39548c37d4455 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Sat, 4 Nov 2017 19:52:06 -0700 Subject: [PATCH] Fix split-brain for blacklistUnverifiedDevices Signed-off-by: Travis Ralston --- src/components/views/rooms/RoomSettings.js | 23 ++++++++++++++++++++-- src/settings/Settings.js | 2 +- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/components/views/rooms/RoomSettings.js b/src/components/views/rooms/RoomSettings.js index 50243ae65f..f0f7a555c1 100644 --- a/src/components/views/rooms/RoomSettings.js +++ b/src/components/views/rooms/RoomSettings.js @@ -365,7 +365,11 @@ module.exports = React.createClass({ saveBlacklistUnverifiedDevicesPerRoom: function() { if (!this.refs.blacklistUnverifiedDevices) return; this.refs.blacklistUnverifiedDevices.save().then(() => { - const value = SettingsStore.getValue("blacklistUnverifiedDevices", this.props.room.roomId); + const value = SettingsStore.getValueAt( + SettingLevel.ROOM_DEVICE, + "blacklistUnverifiedDevices", + this.props.room.roomId, + ); this.props.room.setBlacklistUnverifiedDevices(value); }); }, @@ -579,7 +583,7 @@ module.exports = React.createClass({ const roomState = this.props.room.currentState; const isEncrypted = cli.isRoomEncrypted(this.props.room.roomId); - const settings = ( + let settings = ( ); + const deviceBlacklisting = SettingsStore.getValueAt( + SettingLevel.DEVICE, + "blacklistUnverifiedDevices", + this.props.room.roomId, + /*explicit=*/true + ); + if (deviceBlacklisting === true) { + settings = ( + + ); + } + if (!isEncrypted && roomState.mayClientSendStateEvent("m.room.encryption", cli)) { return (
diff --git a/src/settings/Settings.js b/src/settings/Settings.js index 1408762cc2..42d417ba07 100644 --- a/src/settings/Settings.js +++ b/src/settings/Settings.js @@ -189,7 +189,7 @@ export const SETTINGS = { default: 200, }, "blacklistUnverifiedDevices": { - supportedLevels: LEVELS_DEVICE_ONLY_SETTINGS, + supportedLevels: ['device', 'room-device'], displayName: { "default": _td('Never send encrypted messages to unverified devices from this device'), "room-device": _td('Never send encrypted messages to unverified devices in this room from this device'),