0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-24 23:48:13 -05:00

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
This commit is contained in:
Hannah Wolfe 2021-03-04 20:39:33 +00:00 committed by Hannah Wolfe
parent ea76d5f178
commit 32599caa90
3 changed files with 4 additions and 4 deletions

View file

@ -39,7 +39,7 @@ export default Component.extend(ShortcutsMixin, {
showTagsNavigation: or('session.user.isOwnerOrAdmin', 'session.user.isEditor'), showTagsNavigation: or('session.user.isOwnerOrAdmin', 'session.user.isEditor'),
showMenuExtension: and('config.clientExtensions.menu', 'session.user.isOwner'), showMenuExtension: and('config.clientExtensions.menu', 'session.user.isOwner'),
showScriptExtension: and('config.clientExtensions.script', 'session.user.isOwner'), showScriptExtension: and('config.clientExtensions.script', 'session.user.isOwner'),
showBilling: computed.reads('config.billingUrl'), showBilling: computed.reads('config.hostSettings.billing.enabled'),
init() { init() {
this._super(...arguments); this._super(...arguments);

View file

@ -12,7 +12,7 @@ export default Controller.extend({
settings: service(), settings: service(),
ui: 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 () { showNavMenu: computed('router.currentRouteName', 'session.{isAuthenticated,user.isFulfilled}', 'ui.isFullScreen', function () {
let {router, session, ui} = this; let {router, session, ui} = this;

View file

@ -14,7 +14,7 @@ export default Service.extend({
init() { init() {
this._super(...arguments); this._super(...arguments);
if (this.config.get('billingUrl')) { if (this.config.get('hostSettings.billing.url')) {
window.addEventListener('message', (event) => { window.addEventListener('message', (event) => {
if (event && event.data && event.data.route) { if (event && event.data && event.data.route) {
this.handleRouteChangeInIframe(event.data.route); this.handleRouteChangeInIframe(event.data.route);
@ -38,7 +38,7 @@ export default Service.extend({
}, },
getIframeURL() { 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'))) { if (window.location.hash && window.location.hash.includes(this.get('billingRouteRoot'))) {
let destinationRoute = window.location.hash.replace(this.get('billingRouteRoot'), ''); let destinationRoute = window.location.hash.replace(this.get('billingRouteRoot'), '');