mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-26 12:21:36 +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({
|
export default Controller.extend({
|
||||||
settings: service(),
|
settings: service(),
|
||||||
store: service(),
|
store: service(),
|
||||||
|
config: service(),
|
||||||
|
|
||||||
_allIntegrations: null,
|
_allIntegrations: null,
|
||||||
|
|
||||||
@ -15,6 +16,10 @@ export default Controller.extend({
|
|||||||
this._allIntegrations = this.store.peekAll('integration');
|
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
|
// filter over the live query so that the list is automatically updated
|
||||||
// as integrations are added/removed
|
// as integrations are added/removed
|
||||||
integrations: computed('_allIntegrations.@each.{isNew,type}', function () {
|
integrations: computed('_allIntegrations.@each.{isNew,type}', function () {
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
import AuthenticatedRoute from 'ghost-admin/routes/authenticated';
|
import AuthenticatedRoute from 'ghost-admin/routes/authenticated';
|
||||||
import CurrentUserSettings from 'ghost-admin/mixins/current-user-settings';
|
import CurrentUserSettings from 'ghost-admin/mixins/current-user-settings';
|
||||||
|
import {computed} from '@ember/object';
|
||||||
import {inject as service} from '@ember/service';
|
import {inject as service} from '@ember/service';
|
||||||
|
|
||||||
export default AuthenticatedRoute.extend(CurrentUserSettings, {
|
export default AuthenticatedRoute.extend(CurrentUserSettings, {
|
||||||
router: service(),
|
router: service(),
|
||||||
|
config: service(),
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
this._super(...arguments);
|
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() {
|
beforeModel() {
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
|
|
||||||
return this.get('session.user')
|
return this.get('session.user')
|
||||||
|
.then(this.transitionDisabled())
|
||||||
.then(this.transitionAuthor())
|
.then(this.transitionAuthor())
|
||||||
.then(this.transitionEditor());
|
.then(this.transitionEditor());
|
||||||
},
|
},
|
||||||
@ -31,6 +39,12 @@ export default AuthenticatedRoute.extend(CurrentUserSettings, {
|
|||||||
.integrationModelHook('slug', 'zapier', this, transition);
|
.integrationModelHook('slug', 'zapier', this, transition);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
transitionDisabled() {
|
||||||
|
if (this.get('disabled')) {
|
||||||
|
this.transitionTo('integrations');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
buildRouteInfoMetadata() {
|
buildRouteInfoMetadata() {
|
||||||
return {
|
return {
|
||||||
titleToken: 'Zapier'
|
titleToken: 'Zapier'
|
||||||
|
@ -62,6 +62,7 @@
|
|||||||
<section class="gh-main-section">
|
<section class="gh-main-section">
|
||||||
<h4 class="gh-main-section-header small">Built-in integrations</h4>
|
<h4 class="gh-main-section-header small">Built-in integrations</h4>
|
||||||
<div class="apps-grid">
|
<div class="apps-grid">
|
||||||
|
{{#unless this.zapierDisabled}}
|
||||||
<div class="apps-grid-cell" data-test-app="zapier">
|
<div class="apps-grid-cell" data-test-app="zapier">
|
||||||
<LinkTo @route="integrations.zapier" data-test-link="zapier">
|
<LinkTo @route="integrations.zapier" data-test-link="zapier">
|
||||||
<article class="apps-card-app">
|
<article class="apps-card-app">
|
||||||
@ -81,6 +82,7 @@
|
|||||||
</article>
|
</article>
|
||||||
</LinkTo>
|
</LinkTo>
|
||||||
</div>
|
</div>
|
||||||
|
{{/unless}}
|
||||||
|
|
||||||
<div class="apps-grid-cell" data-test-app="slack">
|
<div class="apps-grid-cell" data-test-app="slack">
|
||||||
<LinkTo @route="integrations.slack" data-test-link="slack">
|
<LinkTo @route="integrations.slack" data-test-link="slack">
|
||||||
|
Loading…
Reference in New Issue
Block a user