diff options
author | 2019-09-13 17:59:46 +0200 | |
---|---|---|
committer | 2019-09-13 17:59:46 +0200 | |
commit | fb095e4984210ec63c5834d6762dec43457dbc57 (patch) | |
tree | a2c8b353313cb363a56722687e110c6f80f4b791 /src/containers | |
parent | Use ferdi namespace on debugger (diff) | |
parent | Update CHANGELOG.md (diff) | |
download | ferdium-app-fb095e4984210ec63c5834d6762dec43457dbc57.tar.gz ferdium-app-fb095e4984210ec63c5834d6762dec43457dbc57.tar.zst ferdium-app-fb095e4984210ec63c5834d6762dec43457dbc57.zip |
Merge branch 'master' of https://github.com/meetfranz/franz into meetfranz-master
Diffstat (limited to 'src/containers')
-rw-r--r-- | src/containers/settings/EditSettingsScreen.js | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/src/containers/settings/EditSettingsScreen.js b/src/containers/settings/EditSettingsScreen.js index 73385d7b8..09e7b43ab 100644 --- a/src/containers/settings/EditSettingsScreen.js +++ b/src/containers/settings/EditSettingsScreen.js | |||
@@ -21,6 +21,8 @@ import { API, TODOS_FRONTEND } from '../../environment'; | |||
21 | 21 | ||
22 | import globalMessages from '../../i18n/globalMessages'; | 22 | import globalMessages from '../../i18n/globalMessages'; |
23 | import { DEFAULT_IS_FEATURE_ENABLED_BY_USER } from '../../features/todos'; | 23 | import { DEFAULT_IS_FEATURE_ENABLED_BY_USER } from '../../features/todos'; |
24 | import WorkspacesStore from '../../features/workspaces/store'; | ||
25 | import { DEFAULT_SETTING_KEEP_ALL_WORKSPACES_LOADED } from '../../features/workspaces'; | ||
24 | 26 | ||
25 | const messages = defineMessages({ | 27 | const messages = defineMessages({ |
26 | autoLaunchOnStart: { | 28 | autoLaunchOnStart: { |
@@ -87,6 +89,10 @@ const messages = defineMessages({ | |||
87 | id: 'settings.app.form.enableTodos', | 89 | id: 'settings.app.form.enableTodos', |
88 | defaultMessage: '!!!Enable Franz Todos', | 90 | defaultMessage: '!!!Enable Franz Todos', |
89 | }, | 91 | }, |
92 | keepAllWorkspacesLoaded: { | ||
93 | id: 'settings.app.form.keepAllWorkspacesLoaded', | ||
94 | defaultMessage: '!!!Keep all workspaces loaded', | ||
95 | }, | ||
90 | }); | 96 | }); |
91 | 97 | ||
92 | export default @inject('stores', 'actions') @observer class EditSettingsScreen extends Component { | 98 | export default @inject('stores', 'actions') @observer class EditSettingsScreen extends Component { |
@@ -95,12 +101,13 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e | |||
95 | }; | 101 | }; |
96 | 102 | ||
97 | onSubmit(settingsData) { | 103 | onSubmit(settingsData) { |
98 | const { todos } = this.props.stores; | 104 | const { todos, workspaces } = this.props.stores; |
99 | const { | 105 | const { |
100 | app, | 106 | app, |
101 | settings, | 107 | settings, |
102 | user, | 108 | user, |
103 | todos: todosActions, | 109 | todos: todosActions, |
110 | workspaces: workspaceActions, | ||
104 | } = this.props.actions; | 111 | } = this.props.actions; |
105 | 112 | ||
106 | app.launchOnStartup({ | 113 | app.launchOnStartup({ |
@@ -135,14 +142,24 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e | |||
135 | }, | 142 | }, |
136 | }); | 143 | }); |
137 | 144 | ||
145 | if (workspaces.isFeatureActive) { | ||
146 | const { keepAllWorkspacesLoaded } = workspaces.settings; | ||
147 | if (keepAllWorkspacesLoaded !== settingsData.keepAllWorkspacesLoaded) { | ||
148 | workspaceActions.toggleKeepAllWorkspacesLoadedSetting(); | ||
149 | } | ||
150 | } | ||
151 | |||
138 | if (todos.isFeatureActive) { | 152 | if (todos.isFeatureActive) { |
139 | todosActions.toggleTodosFeatureVisibility(); | 153 | const { isFeatureEnabledByUser } = todos.settings; |
154 | if (isFeatureEnabledByUser !== settingsData.enableTodos) { | ||
155 | todosActions.toggleTodosFeatureVisibility(); | ||
156 | } | ||
140 | } | 157 | } |
141 | } | 158 | } |
142 | 159 | ||
143 | prepareForm() { | 160 | prepareForm() { |
144 | const { | 161 | const { |
145 | app, settings, user, todos, | 162 | app, settings, user, todos, workspaces, |
146 | } = this.props.stores; | 163 | } = this.props.stores; |
147 | const { intl } = this.context; | 164 | const { intl } = this.context; |
148 | 165 | ||
@@ -242,6 +259,14 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e | |||
242 | }, | 259 | }, |
243 | }; | 260 | }; |
244 | 261 | ||
262 | if (workspaces.isFeatureActive) { | ||
263 | config.fields.keepAllWorkspacesLoaded = { | ||
264 | label: intl.formatMessage(messages.keepAllWorkspacesLoaded), | ||
265 | value: workspaces.settings.keepAllWorkspacesLoaded, | ||
266 | default: DEFAULT_SETTING_KEEP_ALL_WORKSPACES_LOADED, | ||
267 | }; | ||
268 | } | ||
269 | |||
245 | if (todos.isFeatureActive) { | 270 | if (todos.isFeatureActive) { |
246 | config.fields.enableTodos = { | 271 | config.fields.enableTodos = { |
247 | label: intl.formatMessage(messages.enableTodos), | 272 | label: intl.formatMessage(messages.enableTodos), |
@@ -257,6 +282,7 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e | |||
257 | const { | 282 | const { |
258 | app, | 283 | app, |
259 | todos, | 284 | todos, |
285 | workspaces, | ||
260 | } = this.props.stores; | 286 | } = this.props.stores; |
261 | const { | 287 | const { |
262 | updateStatus, | 288 | updateStatus, |
@@ -287,6 +313,7 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e | |||
287 | onClearAllCache={clearAllCache} | 313 | onClearAllCache={clearAllCache} |
288 | isSpellcheckerIncludedInCurrentPlan={spellcheckerConfig.isIncludedInCurrentPlan} | 314 | isSpellcheckerIncludedInCurrentPlan={spellcheckerConfig.isIncludedInCurrentPlan} |
289 | isTodosEnabled={todos.isFeatureActive} | 315 | isTodosEnabled={todos.isFeatureActive} |
316 | isWorkspaceEnabled={workspaces.isFeatureActive} | ||
290 | /> | 317 | /> |
291 | </ErrorBoundary> | 318 | </ErrorBoundary> |
292 | ); | 319 | ); |
@@ -299,6 +326,7 @@ EditSettingsScreen.wrappedComponent.propTypes = { | |||
299 | user: PropTypes.instanceOf(UserStore).isRequired, | 326 | user: PropTypes.instanceOf(UserStore).isRequired, |
300 | settings: PropTypes.instanceOf(SettingsStore).isRequired, | 327 | settings: PropTypes.instanceOf(SettingsStore).isRequired, |
301 | todos: PropTypes.instanceOf(TodosStore).isRequired, | 328 | todos: PropTypes.instanceOf(TodosStore).isRequired, |
329 | workspaces: PropTypes.instanceOf(WorkspacesStore).isRequired, | ||
302 | }).isRequired, | 330 | }).isRequired, |
303 | actions: PropTypes.shape({ | 331 | actions: PropTypes.shape({ |
304 | app: PropTypes.shape({ | 332 | app: PropTypes.shape({ |
@@ -316,5 +344,8 @@ EditSettingsScreen.wrappedComponent.propTypes = { | |||
316 | todos: PropTypes.shape({ | 344 | todos: PropTypes.shape({ |
317 | toggleTodosFeatureVisibility: PropTypes.func.isRequired, | 345 | toggleTodosFeatureVisibility: PropTypes.func.isRequired, |
318 | }).isRequired, | 346 | }).isRequired, |
347 | workspaces: PropTypes.shape({ | ||
348 | toggleAllWorkspacesLoadedSetting: PropTypes.func.isRequired, | ||
349 | }).isRequired, | ||
319 | }).isRequired, | 350 | }).isRequired, |
320 | }; | 351 | }; |