aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLibravatar Dominik Guzei <dominik.guzei@gmail.com>2019-04-04 15:59:09 +0200
committerLibravatar Dominik Guzei <dominik.guzei@gmail.com>2019-04-04 15:59:09 +0200
commit2243edb4aa8d837332e9727217983ec4fe334b58 (patch)
treef511941c9ad1c2a7ab107b9adb169533670ab96c /src
parentfix wrong workspace tooltip shortcut in sidebar (diff)
downloadferdium-app-2243edb4aa8d837332e9727217983ec4fe334b58.tar.gz
ferdium-app-2243edb4aa8d837332e9727217983ec4fe334b58.tar.zst
ferdium-app-2243edb4aa8d837332e9727217983ec4fe334b58.zip
fix bug in workspace feature initialization
Diffstat (limited to 'src')
-rw-r--r--src/features/workspaces/index.js8
-rw-r--r--src/features/workspaces/store.js13
2 files changed, 9 insertions, 12 deletions
diff --git a/src/features/workspaces/index.js b/src/features/workspaces/index.js
index 524a83e3c..fb5135743 100644
--- a/src/features/workspaces/index.js
+++ b/src/features/workspaces/index.js
@@ -10,15 +10,11 @@ export const workspaceStore = new WorkspacesStore();
10 10
11export default function initWorkspaces(stores, actions) { 11export default function initWorkspaces(stores, actions) {
12 stores.workspaces = workspaceStore; 12 stores.workspaces = workspaceStore;
13 const { features, user } = stores; 13 const { features } = stores;
14 14
15 // Toggle workspace feature 15 // Toggle workspace feature
16 reaction( 16 reaction(
17 () => ( 17 () => features.features.isWorkspaceEnabled,
18 features.features.isWorkspaceEnabled && (
19 !features.features.isWorkspacePremiumFeature || user.data.isPremium
20 )
21 ),
22 (isEnabled) => { 18 (isEnabled) => {
23 if (isEnabled && !workspaceStore.isFeatureActive) { 19 if (isEnabled && !workspaceStore.isFeatureActive) {
24 debug('Initializing `workspaces` feature'); 20 debug('Initializing `workspaces` feature');
diff --git a/src/features/workspaces/store.js b/src/features/workspaces/store.js
index 4d65712a7..7bd969be0 100644
--- a/src/features/workspaces/store.js
+++ b/src/features/workspaces/store.js
@@ -19,9 +19,11 @@ const debug = require('debug')('Franz:feature:workspaces:store');
19export default class WorkspacesStore extends FeatureStore { 19export default class WorkspacesStore extends FeatureStore {
20 @observable isFeatureEnabled = false; 20 @observable isFeatureEnabled = false;
21 21
22 @observable isFeatureActive = false;
23
22 @observable isPremiumFeature = true; 24 @observable isPremiumFeature = true;
23 25
24 @observable isFeatureActive = false; 26 @observable isPremiumUpgradeRequired = true;
25 27
26 @observable activeWorkspace = null; 28 @observable activeWorkspace = null;
27 29
@@ -46,10 +48,6 @@ export default class WorkspacesStore extends FeatureStore {
46 return getUserWorkspacesRequest.wasExecuted && this.workspaces.length > 0; 48 return getUserWorkspacesRequest.wasExecuted && this.workspaces.length > 0;
47 } 49 }
48 50
49 @computed get isPremiumUpgradeRequired() {
50 return this.isFeatureEnabled && !this.isFeatureActive;
51 }
52
53 start(stores, actions) { 51 start(stores, actions) {
54 debug('WorkspacesStore::start'); 52 debug('WorkspacesStore::start');
55 this.stores = stores; 53 this.stores = stores;
@@ -194,8 +192,11 @@ export default class WorkspacesStore extends FeatureStore {
194 }; 192 };
195 193
196 _setIsPremiumFeatureReaction = () => { 194 _setIsPremiumFeatureReaction = () => {
197 const { isWorkspacePremiumFeature } = this.stores.features.features; 195 const { features, user } = this.stores;
196 const { isPremium } = user.data;
197 const { isWorkspacePremiumFeature } = features.features;
198 this.isPremiumFeature = isWorkspacePremiumFeature; 198 this.isPremiumFeature = isWorkspacePremiumFeature;
199 this.isPremiumUpgradeRequired = isWorkspacePremiumFeature && !isPremium;
199 }; 200 };
200 201
201 _setWorkspaceBeingEditedReaction = () => { 202 _setWorkspaceBeingEditedReaction = () => {