diff --git a/ghost/admin/app/controllers/integrations.js b/ghost/admin/app/controllers/integrations.js index 6f3a2f7e8d..dfab1f646e 100644 --- a/ghost/admin/app/controllers/integrations.js +++ b/ghost/admin/app/controllers/integrations.js @@ -7,6 +7,7 @@ import {task} from 'ember-concurrency'; export default Controller.extend({ settings: service(), store: service(), + config: service(), _allIntegrations: null, @@ -15,6 +16,10 @@ export default Controller.extend({ this._allIntegrations = this.store.peekAll('integration'); }, + zapierDisabled: computed('config.hostSettings.limits', function () { + return this.config.get('hostSettings.limits.customIntegrations.disabled'); + }), + // filter over the live query so that the list is automatically updated // as integrations are added/removed integrations: computed('_allIntegrations.@each.{isNew,type}', function () { diff --git a/ghost/admin/app/routes/integrations/zapier.js b/ghost/admin/app/routes/integrations/zapier.js index 3db6c69e48..b01aafb935 100644 --- a/ghost/admin/app/routes/integrations/zapier.js +++ b/ghost/admin/app/routes/integrations/zapier.js @@ -1,9 +1,11 @@ import AuthenticatedRoute from 'ghost-admin/routes/authenticated'; import CurrentUserSettings from 'ghost-admin/mixins/current-user-settings'; +import {computed} from '@ember/object'; import {inject as service} from '@ember/service'; export default AuthenticatedRoute.extend(CurrentUserSettings, { router: service(), + config: service(), init() { this._super(...arguments); @@ -15,9 +17,15 @@ export default AuthenticatedRoute.extend(CurrentUserSettings, { }); }, + disabled: computed('config.hostSettings.limits', function () { + return this.config.get('hostSettings.limits.customIntegrations.disabled'); + }), + beforeModel() { this._super(...arguments); + return this.get('session.user') + .then(this.transitionDisabled()) .then(this.transitionAuthor()) .then(this.transitionEditor()); }, @@ -31,6 +39,12 @@ export default AuthenticatedRoute.extend(CurrentUserSettings, { .integrationModelHook('slug', 'zapier', this, transition); }, + transitionDisabled() { + if (this.get('disabled')) { + this.transitionTo('integrations'); + } + }, + buildRouteInfoMetadata() { return { titleToken: 'Zapier' diff --git a/ghost/admin/app/templates/integrations.hbs b/ghost/admin/app/templates/integrations.hbs index a32952bf2b..e493ab0f1e 100644 --- a/ghost/admin/app/templates/integrations.hbs +++ b/ghost/admin/app/templates/integrations.hbs @@ -62,6 +62,7 @@

Built-in integrations

+ {{#unless this.zapierDisabled}}
@@ -81,6 +82,7 @@
+ {{/unless}}