From 32599caa9031c42313db488e61a76872e7fae2d0 Mon Sep 17 00:00:00 2001 From: Hannah Wolfe Date: Thu, 4 Mar 2021 20:39:33 +0000 Subject: [PATCH] Updated to handle new Config API response refs: https://github.com/TryGhost/Team/issues/510 - The config API has been changed to return the full hostSettings key, not just the billing URL - This has been done because we are adding more config, and it's easier to reason about if Admin has the same config as server - Proxying each value also requires multiple updates to the API each time - This updates all the places where the old values were used --- ghost/admin/app/components/gh-nav-menu/main.js | 2 +- ghost/admin/app/controllers/application.js | 2 +- ghost/admin/app/services/billing.js | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ghost/admin/app/components/gh-nav-menu/main.js b/ghost/admin/app/components/gh-nav-menu/main.js index 590046fa20..efca7614f4 100644 --- a/ghost/admin/app/components/gh-nav-menu/main.js +++ b/ghost/admin/app/components/gh-nav-menu/main.js @@ -39,7 +39,7 @@ export default Component.extend(ShortcutsMixin, { showTagsNavigation: or('session.user.isOwnerOrAdmin', 'session.user.isEditor'), showMenuExtension: and('config.clientExtensions.menu', 'session.user.isOwner'), showScriptExtension: and('config.clientExtensions.script', 'session.user.isOwner'), - showBilling: computed.reads('config.billingUrl'), + showBilling: computed.reads('config.hostSettings.billing.enabled'), init() { this._super(...arguments); diff --git a/ghost/admin/app/controllers/application.js b/ghost/admin/app/controllers/application.js index 109d7b8faf..77e3685c95 100644 --- a/ghost/admin/app/controllers/application.js +++ b/ghost/admin/app/controllers/application.js @@ -12,7 +12,7 @@ export default Controller.extend({ settings: service(), ui: service(), - showBilling: computed.reads('config.billingUrl'), + showBilling: computed.reads('config.hostSettings.billing.enabled'), showNavMenu: computed('router.currentRouteName', 'session.{isAuthenticated,user.isFulfilled}', 'ui.isFullScreen', function () { let {router, session, ui} = this; diff --git a/ghost/admin/app/services/billing.js b/ghost/admin/app/services/billing.js index a2d285a0a8..bc74cbe166 100644 --- a/ghost/admin/app/services/billing.js +++ b/ghost/admin/app/services/billing.js @@ -14,7 +14,7 @@ export default Service.extend({ init() { this._super(...arguments); - if (this.config.get('billingUrl')) { + if (this.config.get('hostSettings.billing.url')) { window.addEventListener('message', (event) => { if (event && event.data && event.data.route) { this.handleRouteChangeInIframe(event.data.route); @@ -38,7 +38,7 @@ export default Service.extend({ }, getIframeURL() { - let url = this.config.get('billingUrl'); + let url = this.config.get('hostSettings.billing.url'); if (window.location.hash && window.location.hash.includes(this.get('billingRouteRoot'))) { let destinationRoute = window.location.hash.replace(this.get('billingRouteRoot'), '');