mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-01 05:50:35 +03:00
6339770a67
no issue - passed correct action for opening stripe connect modal through to portal settings modal - updated `<GhTaskButton>` to accept a `@unlinkedTask=true/false` property - ember-concurrency will throw warnings about unsafe task cancellation if the initiator of a task is destroyed due to the actions of a task. Eg. the stripe connect button being replaced with the plan checkboxes because stripe connect details are added to settings - to avoid warnings ember-concurrency expects the task initiation to be marked as "unlinked" so that the task is allowed to continue even though the initiator is destroyed - updated `<GhSiteIframe>` to force a refresh when the `@guid` property changes - we want the portal preview to fully reload so that it can fetch server data and see that stripe is connected - updated portal settings modal to initiate a refresh when switching from "connect to stripe" to the plans checkboxes that happens automatically after a successful stripe connection
47 lines
1.4 KiB
JavaScript
47 lines
1.4 KiB
JavaScript
import Component from '@glimmer/component';
|
|
import {action} from '@ember/object';
|
|
import {inject as service} from '@ember/service';
|
|
import {tracked} from '@glimmer/tracking';
|
|
|
|
export default class GhSiteIframeComponent extends Component {
|
|
@service config;
|
|
|
|
@tracked isInvisible = this.args.invisibleUntilLoaded;
|
|
|
|
willDestroy() {
|
|
this.args.onDestroyed?.();
|
|
}
|
|
|
|
get srcUrl() {
|
|
return this.args.src || `${this.config.get('blogUrl')}/`;
|
|
}
|
|
|
|
@action
|
|
resetSrcAttribute(iframe) {
|
|
// reset the src attribute and force reload each time the guid changes
|
|
// - allows for a click on the navigation item to reset back to the homepage
|
|
// or a portal preview modal to force a reload so it can fetch server-side data
|
|
if (this.args.guid !== this._lastGuid) {
|
|
if (iframe) {
|
|
if (this.args.invisibleUntilLoaded) {
|
|
this.isInvisible = true;
|
|
}
|
|
if (iframe.contentWindow.location.href !== this.srcUrl) {
|
|
iframe.contentWindow.location = this.srcUrl;
|
|
} else {
|
|
iframe.contentWindow.location.reload();
|
|
}
|
|
}
|
|
}
|
|
this._lastGuid = this.args.guid;
|
|
}
|
|
|
|
@action
|
|
onLoad(event) {
|
|
if (this.args.invisibleUntilLoaded) {
|
|
this.isInvisible = false;
|
|
}
|
|
this.args.onLoad?.(event);
|
|
}
|
|
}
|