diff options
author | ThibG <thib@sitedethib.com> | 2019-07-17 16:56:10 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-17 16:56:10 +0200 |
commit | e9cc17bbeab1f1d47b5a919adb0ae7eae4eee791 (patch) | |
tree | 21f25d570ea6f57d58c24eec6e65aab8b96f816b /app/javascript/flavours/glitch/features/notifications/components | |
parent | 5ccd011cc3bafc00a557dabbb47da004f3d4a381 (diff) | |
parent | e91bf82083ac390a0cf229d8e94fa412fdec57ff (diff) |
Merge pull request #1164 from ThibG/glitch-soc/cherry-pick-upstream
Cherry-pick changes from upstream
Diffstat (limited to 'app/javascript/flavours/glitch/features/notifications/components')
-rw-r--r-- | app/javascript/flavours/glitch/features/notifications/components/setting_toggle.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/app/javascript/flavours/glitch/features/notifications/components/setting_toggle.js b/app/javascript/flavours/glitch/features/notifications/components/setting_toggle.js index ac2211e48..0264b6815 100644 --- a/app/javascript/flavours/glitch/features/notifications/components/setting_toggle.js +++ b/app/javascript/flavours/glitch/features/notifications/components/setting_toggle.js @@ -12,6 +12,7 @@ export default class SettingToggle extends React.PureComponent { label: PropTypes.node.isRequired, meta: PropTypes.node, onChange: PropTypes.func.isRequired, + defaultValue: PropTypes.bool, } onChange = ({ target }) => { @@ -19,12 +20,12 @@ export default class SettingToggle extends React.PureComponent { } render () { - const { prefix, settings, settingPath, label, meta } = this.props; + const { prefix, settings, settingPath, label, meta, defaultValue } = this.props; const id = ['setting-toggle', prefix, ...settingPath].filter(Boolean).join('-'); return ( <div className='setting-toggle'> - <Toggle id={id} checked={settings.getIn(settingPath)} onChange={this.onChange} onKeyDown={this.onKeyDown} /> + <Toggle id={id} checked={settings.getIn(settingPath, defaultValue)} onChange={this.onChange} onKeyDown={this.onKeyDown} /> <label htmlFor={id} className='setting-toggle__label'>{label}</label> {meta && <span className='setting-meta__label'>{meta}</span>} </div> |