aboutsummaryrefslogtreecommitdiffstats
path: root/src/features/workspaces/store.js
diff options
context:
space:
mode:
authorLibravatar Stefan Malzner <stefan@adlk.io>2019-08-09 08:33:13 +0200
committerLibravatar Stefan Malzner <stefan@adlk.io>2019-08-09 08:33:13 +0200
commit74c1ee9bc3460b6de4bd153a0be873819f7aacd6 (patch)
treec8b915d15691adcbd92baea157344db1f0447889 /src/features/workspaces/store.js
parentAdd option to subscribe to trial via account dashboard (diff)
parentbump version (diff)
downloadferdium-app-74c1ee9bc3460b6de4bd153a0be873819f7aacd6.tar.gz
ferdium-app-74c1ee9bc3460b6de4bd153a0be873819f7aacd6.tar.zst
ferdium-app-74c1ee9bc3460b6de4bd153a0be873819f7aacd6.zip
Merge branch 'develop' into feature/new-pricing
Diffstat (limited to 'src/features/workspaces/store.js')
-rw-r--r--src/features/workspaces/store.js21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/features/workspaces/store.js b/src/features/workspaces/store.js
index e1adc9cab..caa73619e 100644
--- a/src/features/workspaces/store.js
+++ b/src/features/workspaces/store.js
@@ -79,7 +79,7 @@ export default class WorkspacesStore extends FeatureStore {
79 79
80 // ========== PUBLIC API ========= // 80 // ========== PUBLIC API ========= //
81 81
82 start(stores, actions) { 82 @action start(stores, actions) {
83 debug('WorkspacesStore::start'); 83 debug('WorkspacesStore::start');
84 this.stores = stores; 84 this.stores = stores;
85 this.actions = actions; 85 this.actions = actions;
@@ -104,7 +104,7 @@ export default class WorkspacesStore extends FeatureStore {
104 // REACTIONS 104 // REACTIONS
105 105
106 this._freeUserReactions = createReactions([ 106 this._freeUserReactions = createReactions([
107 this._stopPremiumActionsAndReactions, 107 this._disablePremiumFeatures,
108 this._openDrawerWithSettingsReaction, 108 this._openDrawerWithSettingsReaction,
109 this._setFeatureEnabledReaction, 109 this._setFeatureEnabledReaction,
110 this._setIsPremiumFeatureReaction, 110 this._setIsPremiumFeatureReaction,
@@ -123,10 +123,7 @@ export default class WorkspacesStore extends FeatureStore {
123 this.isFeatureActive = true; 123 this.isFeatureActive = true;
124 } 124 }
125 125
126 stop() { 126 @action reset() {
127 super.stop();
128 debug('WorkspacesStore::stop');
129 this.isFeatureActive = false;
130 this.activeWorkspace = null; 127 this.activeWorkspace = null;
131 this.nextWorkspace = null; 128 this.nextWorkspace = null;
132 this.workspaceBeingEdited = null; 129 this.workspaceBeingEdited = null;
@@ -134,6 +131,13 @@ export default class WorkspacesStore extends FeatureStore {
134 this.isWorkspaceDrawerOpen = false; 131 this.isWorkspaceDrawerOpen = false;
135 } 132 }
136 133
134 @action stop() {
135 super.stop();
136 debug('WorkspacesStore::stop');
137 this.reset();
138 this.isFeatureActive = false;
139 }
140
137 filterServicesByActiveWorkspace = (services) => { 141 filterServicesByActiveWorkspace = (services) => {
138 const { activeWorkspace, isFeatureActive } = this; 142 const { activeWorkspace, isFeatureActive } = this;
139 if (isFeatureActive && activeWorkspace) { 143 if (isFeatureActive && activeWorkspace) {
@@ -281,6 +285,7 @@ export default class WorkspacesStore extends FeatureStore {
281 }; 285 };
282 286
283 _activateLastUsedWorkspaceReaction = () => { 287 _activateLastUsedWorkspaceReaction = () => {
288 debug('_activateLastUsedWorkspaceReaction');
284 if (!this.activeWorkspace && this.userHasWorkspaces) { 289 if (!this.activeWorkspace && this.userHasWorkspaces) {
285 const { lastActiveWorkspace } = this.settings; 290 const { lastActiveWorkspace } = this.settings;
286 if (lastActiveWorkspace) { 291 if (lastActiveWorkspace) {
@@ -324,10 +329,12 @@ export default class WorkspacesStore extends FeatureStore {
324 }); 329 });
325 }; 330 };
326 331
327 _stopPremiumActionsAndReactions = () => { 332 _disablePremiumFeatures = () => {
328 if (!this.isUserAllowedToUseFeature) { 333 if (!this.isUserAllowedToUseFeature) {
334 debug('_disablePremiumFeatures');
329 this._stopActions(this._premiumUserActions); 335 this._stopActions(this._premiumUserActions);
330 this._stopReactions(this._premiumUserReactions); 336 this._stopReactions(this._premiumUserReactions);
337 this.reset();
331 } else { 338 } else {
332 this._startActions(this._premiumUserActions); 339 this._startActions(this._premiumUserActions);
333 this._startReactions(this._premiumUserReactions); 340 this._startReactions(this._premiumUserReactions);