aboutsummaryrefslogtreecommitdiffstats
path: root/src/features/serviceLimit
diff options
context:
space:
mode:
authorLibravatar Stefan Malzner <stefan@adlk.io>2019-06-13 15:15:38 +0200
committerLibravatar Stefan Malzner <stefan@adlk.io>2019-06-13 15:15:38 +0200
commit66647005ae23bccf1691a43ea36565cae4ce9518 (patch)
tree08d5c2a8bf3326e5b36c64bdcf7edd6ebda1ff2f /src/features/serviceLimit
parentMerge branch 'develop' into feature/service-limit (diff)
downloadferdium-app-66647005ae23bccf1691a43ea36565cae4ce9518.tar.gz
ferdium-app-66647005ae23bccf1691a43ea36565cae4ce9518.tar.zst
ferdium-app-66647005ae23bccf1691a43ea36565cae4ce9518.zip
Improve serviceLimit implementation
Diffstat (limited to 'src/features/serviceLimit')
-rw-r--r--src/features/serviceLimit/components/LimitReachedInfobox.js4
-rw-r--r--src/features/serviceLimit/index.js2
-rw-r--r--src/features/serviceLimit/store.js6
3 files changed, 8 insertions, 4 deletions
diff --git a/src/features/serviceLimit/components/LimitReachedInfobox.js b/src/features/serviceLimit/components/LimitReachedInfobox.js
index ee0d7cb27..fc54dcf85 100644
--- a/src/features/serviceLimit/components/LimitReachedInfobox.js
+++ b/src/features/serviceLimit/components/LimitReachedInfobox.js
@@ -26,6 +26,10 @@ const styles = theme => ({
26 borderRadius: 0, 26 borderRadius: 0,
27 marginBottom: 0, 27 marginBottom: 0,
28 28
29 '& > div': {
30 marginBottom: 0,
31 },
32
29 '& button': { 33 '& button': {
30 color: theme.styleTypes.primary.contrast, 34 color: theme.styleTypes.primary.contrast,
31 }, 35 },
diff --git a/src/features/serviceLimit/index.js b/src/features/serviceLimit/index.js
index 76f996195..92ad8bb98 100644
--- a/src/features/serviceLimit/index.js
+++ b/src/features/serviceLimit/index.js
@@ -15,7 +15,7 @@ export default function initServiceLimit(stores, actions) {
15 // Toggle serviceLimit feature 15 // Toggle serviceLimit feature
16 reaction( 16 reaction(
17 () => ( 17 () => (
18 features.features.hasServiceLimit 18 features.features.isServiceLimitEnabled
19 ), 19 ),
20 (isEnabled) => { 20 (isEnabled) => {
21 if (isEnabled) { 21 if (isEnabled) {
diff --git a/src/features/serviceLimit/store.js b/src/features/serviceLimit/store.js
index 752f71371..9836c5f51 100644
--- a/src/features/serviceLimit/store.js
+++ b/src/features/serviceLimit/store.js
@@ -24,12 +24,12 @@ export class ServiceLimitStore extends FeatureStore {
24 @computed get userHasReachedServiceLimit() { 24 @computed get userHasReachedServiceLimit() {
25 if (!this.isServiceLimitEnabled) return false; 25 if (!this.isServiceLimitEnabled) return false;
26 26
27 const { user } = this.stores; 27 return this.serviceLimit !== 0 && this.serviceCount >= this.serviceLimit;
28
29 return !user.isPremium && this.serviceCount >= this.serviceLimit;
30 } 28 }
31 29
32 @computed get serviceLimit() { 30 @computed get serviceLimit() {
31 if (!this.isServiceLimitEnabled || this.stores.features.features.serviceLimitCount === 0) return 0;
32
33 return this.stores.features.features.serviceLimitCount || DEFAULT_SERVICE_LIMIT; 33 return this.stores.features.features.serviceLimitCount || DEFAULT_SERVICE_LIMIT;
34 } 34 }
35 35