about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/features/notifications/components
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2019-07-16 06:30:47 +0200
committerThibaut Girka <thib@sitedethib.com>2019-07-16 16:51:08 +0200
commite91bf82083ac390a0cf229d8e94fa412fdec57ff (patch)
tree21f25d570ea6f57d58c24eec6e65aab8b96f816b /app/javascript/flavours/glitch/features/notifications/components
parentc8a47595fb4a54af6a50a82bf0dbae4950586264 (diff)
[Glitch] Add option to disable real-time updates in web UI
Port 729723f857d11434c0f78d63fe16537d77f1c77c to glitch-soc

Signed-off-by: Thibaut Girka <thib@sitedethib.com>
Diffstat (limited to 'app/javascript/flavours/glitch/features/notifications/components')
-rw-r--r--app/javascript/flavours/glitch/features/notifications/components/setting_toggle.js5
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>