fix ugly special casing in generic settings renderer
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
75e386e0ee
commit
97d0c41d30
1 changed files with 11 additions and 6 deletions
|
@ -97,6 +97,9 @@ const CRYPTO_SETTINGS_LABELS = [
|
||||||
{
|
{
|
||||||
id: 'blacklistUnverifiedDevices',
|
id: 'blacklistUnverifiedDevices',
|
||||||
label: 'Never send encrypted messages to unverified devices from this device',
|
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
|
// XXX: this is here for documentation; the actual setting is managed via RoomSettings
|
||||||
// {
|
// {
|
||||||
|
@ -600,7 +603,12 @@ module.exports = React.createClass({
|
||||||
<input id={ setting.id }
|
<input id={ setting.id }
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
defaultChecked={ this._syncedSettings[setting.id] }
|
defaultChecked={ this._syncedSettings[setting.id] }
|
||||||
onChange={ (e) => UserSettingsStore.setSyncedSetting(setting.id, e.target.checked) }
|
onChange={
|
||||||
|
(e) => {
|
||||||
|
UserSettingsStore.setSyncedSetting(setting.id, e.target.checked);
|
||||||
|
if (setting.fn) setting.fn(e.target.checked);
|
||||||
|
}
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
<label htmlFor={ setting.id }>
|
<label htmlFor={ setting.id }>
|
||||||
{ _t(setting.label) }
|
{ _t(setting.label) }
|
||||||
|
@ -676,7 +684,6 @@ module.exports = React.createClass({
|
||||||
},
|
},
|
||||||
|
|
||||||
_renderLocalSetting: function(setting) {
|
_renderLocalSetting: function(setting) {
|
||||||
const client = MatrixClientPeg.get();
|
|
||||||
return <div className="mx_UserSettings_toggle" key={ setting.id }>
|
return <div className="mx_UserSettings_toggle" key={ setting.id }>
|
||||||
<input id={ setting.id }
|
<input id={ setting.id }
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
|
@ -684,9 +691,7 @@ module.exports = React.createClass({
|
||||||
onChange={
|
onChange={
|
||||||
(e) => {
|
(e) => {
|
||||||
UserSettingsStore.setLocalSetting(setting.id, e.target.checked);
|
UserSettingsStore.setLocalSetting(setting.id, e.target.checked);
|
||||||
if (setting.id === 'blacklistUnverifiedDevices') { // XXX: this is a bit ugly
|
if (setting.fn) setting.fn(e.target.checked);
|
||||||
client.setGlobalBlacklistUnverifiedDevices(e.target.checked);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue