From 907796d857478de096bb35bfcda1f1eec19648ca Mon Sep 17 00:00:00 2001 From: Aileen Booker Date: Mon, 25 Sep 2023 12:35:02 +0100 Subject: [PATCH] Fixed ForceUpgrade state not working with Explore no issue - When a user is in forced upgrade state, clicking on `Explore` would keep them trapped inside of the Explore frame rather than redirecting to Ghost(Pro) --- ghost/admin/app/services/explore.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ghost/admin/app/services/explore.js b/ghost/admin/app/services/explore.js index e3fc8afa77..5efaa2b462 100644 --- a/ghost/admin/app/services/explore.js +++ b/ghost/admin/app/services/explore.js @@ -1,4 +1,5 @@ import Service, {inject as service} from '@ember/service'; +import {inject} from 'ghost-admin/decorators/inject'; import {tracked} from '@glimmer/tracking'; export default class ExploreService extends Service { @@ -6,6 +7,8 @@ export default class ExploreService extends Service { @service feature; @service ghostPaths; + @inject config; + exploreUrl = 'https://ghost.org/explore/'; exploreRouteRoot = '#/explore'; submitRoute = 'submit'; @@ -88,6 +91,11 @@ export default class ExploreService extends Service { // and the URL opened on the iframe. It is responsible to non user triggered iframe opening, // for example: by entering "/explore" route in the URL or using history navigation (back and forward) toggleExploreWindow(value) { + if (this.config.hostSettings?.forceUpgrade && value) { + // don't attempt to open Explore iframe when in Force Upgrade state + return; + } + if (this.exploreWindowOpen && value) { // don't attempt to open again return; @@ -96,6 +104,10 @@ export default class ExploreService extends Service { } openExploreWindow() { + if (this.config.hostSettings?.forceUpgrade) { + // don't attempt to open Explore iframe when in Force Upgrade state + return; + } if (this.exploreWindowOpen) { // don't attempt to open again return;