diff --git a/src/components/structures/UserSettings.js b/src/components/structures/UserSettings.js index 2f8f1ac002..c01a7d2cc7 100644 --- a/src/components/structures/UserSettings.js +++ b/src/components/structures/UserSettings.js @@ -97,6 +97,9 @@ const CRYPTO_SETTINGS_LABELS = [ { id: 'blacklistUnverifiedDevices', label: 'Never send encrypted messages to unverified devices from this device', + fn: function(checked) { + MatrixClientPeg.get().setGlobalBlacklistUnverifiedDevices(checked); + }, }, // XXX: this is here for documentation; the actual setting is managed via RoomSettings // { @@ -600,7 +603,12 @@ module.exports = React.createClass({ UserSettingsStore.setSyncedSetting(setting.id, e.target.checked) } + onChange={ + (e) => { + UserSettingsStore.setSyncedSetting(setting.id, e.target.checked); + if (setting.fn) setting.fn(e.target.checked); + } + } /> { _t(setting.label) } @@ -676,7 +684,6 @@ module.exports = React.createClass({ }, _renderLocalSetting: function(setting) { - const client = MatrixClientPeg.get(); return { UserSettingsStore.setLocalSetting(setting.id, e.target.checked); - if (setting.id === 'blacklistUnverifiedDevices') { // XXX: this is a bit ugly - client.setGlobalBlacklistUnverifiedDevices(e.target.checked); - } + if (setting.fn) setting.fn(e.target.checked); } - } + } /> { _t(setting.label) }