Fix split-brain for blacklistUnverifiedDevices

Signed-off-by: Travis Ralston <travpc@gmail.com>
pull/21833/head
Travis Ralston 2017-11-04 19:52:06 -07:00
parent cb17c0a379
commit b75be41f94
2 changed files with 22 additions and 3 deletions

View File

@ -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 = (
<SettingsFlag name="blacklistUnverifiedDevices"
level={SettingLevel.ROOM_DEVICE}
roomId={this.props.room.roomId}
@ -588,6 +592,21 @@ module.exports = React.createClass({
/>
);
const deviceBlacklisting = SettingsStore.getValueAt(
SettingLevel.DEVICE,
"blacklistUnverifiedDevices",
this.props.room.roomId,
/*explicit=*/true
);
if (deviceBlacklisting === true) {
settings = (
<label>
<input type="checkbox" disabled={true} checked={true} />
{ SettingsStore.getDisplayName("blacklistUnverifiedDevices", SettingLevel.ROOM_DEVICE) }
</label>
);
}
if (!isEncrypted && roomState.mayClientSendStateEvent("m.room.encryption", cli)) {
return (
<div>

View File

@ -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'),