diff options
author | 2021-10-27 07:25:26 +0530 | |
---|---|---|
committer | 2021-10-27 07:25:26 +0530 | |
commit | 477bdd76a7405ff10a5cfabdec00ee9ae02f2698 (patch) | |
tree | bfa8cfb70e6852b9f535ccfd9b05712269a70dc1 /src/features/workspaces | |
parent | Bumped up ferdi beta version to '5.6.3-beta.2' (diff) | |
parent | 5.6.3-nightly.44 [skip ci] (diff) | |
download | ferdium-app-477bdd76a7405ff10a5cfabdec00ee9ae02f2698.tar.gz ferdium-app-477bdd76a7405ff10a5cfabdec00ee9ae02f2698.tar.zst ferdium-app-477bdd76a7405ff10a5cfabdec00ee9ae02f2698.zip |
Merge branch 'nightly' into release
Diffstat (limited to 'src/features/workspaces')
-rw-r--r-- | src/features/workspaces/index.ts | 22 | ||||
-rw-r--r-- | src/features/workspaces/store.js | 8 |
2 files changed, 1 insertions, 29 deletions
diff --git a/src/features/workspaces/index.ts b/src/features/workspaces/index.ts index ecca64b41..25975936a 100644 --- a/src/features/workspaces/index.ts +++ b/src/features/workspaces/index.ts | |||
@@ -1,28 +1,8 @@ | |||
1 | import { reaction } from 'mobx'; | ||
2 | import WorkspacesStore from './store'; | 1 | import WorkspacesStore from './store'; |
3 | import { resetApiRequests } from './api'; | ||
4 | |||
5 | const debug = require('debug')('Ferdi:feature:workspaces'); | ||
6 | 2 | ||
7 | export const workspaceStore = new WorkspacesStore(); | 3 | export const workspaceStore = new WorkspacesStore(); |
8 | 4 | ||
9 | export default function initWorkspaces(stores, actions) { | 5 | export default function initWorkspaces(stores, actions) { |
10 | stores.workspaces = workspaceStore; | 6 | stores.workspaces = workspaceStore; |
11 | const { features } = stores; | 7 | workspaceStore.start(stores, actions); |
12 | |||
13 | // Toggle workspace feature | ||
14 | reaction( | ||
15 | () => features.features.isWorkspaceEnabled, | ||
16 | isEnabled => { | ||
17 | if (isEnabled && !workspaceStore.isFeatureActive) { | ||
18 | debug('Initializing `workspaces` feature'); | ||
19 | workspaceStore.start(stores, actions); | ||
20 | } else if (workspaceStore.isFeatureActive) { | ||
21 | debug('Disabling `workspaces` feature'); | ||
22 | workspaceStore.stop(); | ||
23 | resetApiRequests(); | ||
24 | } | ||
25 | }, | ||
26 | { fireImmediately: true }, | ||
27 | ); | ||
28 | } | 8 | } |
diff --git a/src/features/workspaces/store.js b/src/features/workspaces/store.js index 0fa43b723..17ec17b3a 100644 --- a/src/features/workspaces/store.js +++ b/src/features/workspaces/store.js | |||
@@ -18,8 +18,6 @@ import { KEEP_WS_LOADED_USID } from '../../config'; | |||
18 | const debug = require('debug')('Ferdi:feature:workspaces:store'); | 18 | const debug = require('debug')('Ferdi:feature:workspaces:store'); |
19 | 19 | ||
20 | export default class WorkspacesStore extends FeatureStore { | 20 | export default class WorkspacesStore extends FeatureStore { |
21 | @observable isFeatureEnabled = true; | ||
22 | |||
23 | @observable isFeatureActive = false; | 21 | @observable isFeatureActive = false; |
24 | 22 | ||
25 | @observable activeWorkspace = null; | 23 | @observable activeWorkspace = null; |
@@ -97,7 +95,6 @@ export default class WorkspacesStore extends FeatureStore { | |||
97 | 95 | ||
98 | this._allReactions = createReactions([ | 96 | this._allReactions = createReactions([ |
99 | this._openDrawerWithSettingsReaction, | 97 | this._openDrawerWithSettingsReaction, |
100 | this._setFeatureEnabledReaction, | ||
101 | this._cleanupInvalidServiceReferences, | 98 | this._cleanupInvalidServiceReferences, |
102 | this._setActiveServiceOnWorkspaceSwitchReaction, | 99 | this._setActiveServiceOnWorkspaceSwitchReaction, |
103 | this._activateLastUsedWorkspaceReaction, | 100 | this._activateLastUsedWorkspaceReaction, |
@@ -251,11 +248,6 @@ export default class WorkspacesStore extends FeatureStore { | |||
251 | 248 | ||
252 | // Reactions | 249 | // Reactions |
253 | 250 | ||
254 | _setFeatureEnabledReaction = () => { | ||
255 | const { isWorkspaceEnabled } = this.stores.features.features; | ||
256 | this.isFeatureEnabled = isWorkspaceEnabled; | ||
257 | }; | ||
258 | |||
259 | _setWorkspaceBeingEditedReaction = () => { | 251 | _setWorkspaceBeingEditedReaction = () => { |
260 | const { pathname } = this.stores.router.location; | 252 | const { pathname } = this.stores.router.location; |
261 | const match = matchRoute('/settings/workspaces/edit/:id', pathname); | 253 | const match = matchRoute('/settings/workspaces/edit/:id', pathname); |