mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05:00
parent
47f0969ac2
commit
7b99c555c5
2 changed files with 24 additions and 22 deletions
|
@ -2,9 +2,9 @@ import Controller from '@ember/controller';
|
||||||
import {inject as service} from '@ember/service';
|
import {inject as service} from '@ember/service';
|
||||||
|
|
||||||
export default class UploadThemeController extends Controller {
|
export default class UploadThemeController extends Controller {
|
||||||
@service config;
|
@service limit;
|
||||||
|
|
||||||
get isAllowed() {
|
get isAllowed() {
|
||||||
return (!this.config.get('hostSettings')?.limits?.customThemes) || !this.config.get('hostSettings').limits.customThemes.disabled;
|
return !this.limit.limiter.isLimited('customThemes');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,28 +33,30 @@ export default class LimitsService extends Service {
|
||||||
|
|
||||||
let limits = this.config.get('hostSettings.limits');
|
let limits = this.config.get('hostSettings.limits');
|
||||||
|
|
||||||
if (limits && !this.limiter) {
|
this.limiter = new LimitService();
|
||||||
this.limiter = new LimitService();
|
|
||||||
|
|
||||||
let helpLink;
|
if (!limits) {
|
||||||
|
return;
|
||||||
if (this.config.get('hostSettings.billing.enabled')
|
|
||||||
&& this.config.get('hostSettings.billing.enabled') === true
|
|
||||||
&& this.config.get('hostSettings.billing.url')) {
|
|
||||||
helpLink = this.config.get('hostSettings.billing.url');
|
|
||||||
} else {
|
|
||||||
helpLink = 'https://ghost.org/help/';
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.limiter.loadLimits({
|
|
||||||
limits: this.decorateWithCountQueries(limits),
|
|
||||||
helpLink,
|
|
||||||
errors: {
|
|
||||||
HostLimitError,
|
|
||||||
IncorrectUsageError
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let helpLink;
|
||||||
|
|
||||||
|
if (this.config.get('hostSettings.billing.enabled')
|
||||||
|
&& this.config.get('hostSettings.billing.enabled') === true
|
||||||
|
&& this.config.get('hostSettings.billing.url')) {
|
||||||
|
helpLink = this.config.get('hostSettings.billing.url');
|
||||||
|
} else {
|
||||||
|
helpLink = 'https://ghost.org/help/';
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.limiter.loadLimits({
|
||||||
|
limits: this.decorateWithCountQueries(limits),
|
||||||
|
helpLink,
|
||||||
|
errors: {
|
||||||
|
HostLimitError,
|
||||||
|
IncorrectUsageError
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
decorateWithCountQueries(limits) {
|
decorateWithCountQueries(limits) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue