mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-25 20:03:12 +03:00
Disabled zapier if custom integrations are disabled
refs: https://github.com/TryGhost/Team/issues/510 - Use the new limit config to disable the Zapier integration if custom integrations are disabled
This commit is contained in:
parent
ddd41e3b46
commit
6a1f71e92d
@ -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 () {
|
||||
|
@ -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'
|
||||
|
@ -62,6 +62,7 @@
|
||||
<section class="gh-main-section">
|
||||
<h4 class="gh-main-section-header small">Built-in integrations</h4>
|
||||
<div class="apps-grid">
|
||||
{{#unless this.zapierDisabled}}
|
||||
<div class="apps-grid-cell" data-test-app="zapier">
|
||||
<LinkTo @route="integrations.zapier" data-test-link="zapier">
|
||||
<article class="apps-card-app">
|
||||
@ -81,6 +82,7 @@
|
||||
</article>
|
||||
</LinkTo>
|
||||
</div>
|
||||
{{/unless}}
|
||||
|
||||
<div class="apps-grid-cell" data-test-app="slack">
|
||||
<LinkTo @route="integrations.slack" data-test-link="slack">
|
||||
|
Loading…
Reference in New Issue
Block a user