Fixed tier archive not updating portal preview
The tier visibility is now handled by visibility property on object, this change ensures portal preview is updated on a tier archive to show the correct Portal UI.
This commit is contained in:
parent
f65437b14c
commit
82d6d38b3f
@ -30,6 +30,7 @@
|
||||
@product={{product}}
|
||||
@openEditProduct={{this.openEditProduct}}
|
||||
@onUnarchive={{this.onUnarchive}}
|
||||
@onArchive={{this.onArchive}}
|
||||
/>
|
||||
{{/each}}
|
||||
{{#if (eq this.type "active" )}}
|
||||
|
@ -60,6 +60,12 @@ export default class extends Component {
|
||||
@action
|
||||
async onUnarchive() {
|
||||
this.type = 'active';
|
||||
this.args.updatePortalPreview();
|
||||
}
|
||||
|
||||
@action
|
||||
async onArchive() {
|
||||
this.args.updatePortalPreview();
|
||||
}
|
||||
|
||||
@action
|
||||
|
@ -84,6 +84,7 @@
|
||||
<Settings::Members::ArchiveTier
|
||||
@product={{@product}}
|
||||
@onUnarchive={{@onUnarchive}}
|
||||
@onArchive={{@onArchive}}
|
||||
/>
|
||||
</li>
|
||||
{{/if}}
|
||||
|
@ -52,7 +52,9 @@ export default ModalComponent.extend({
|
||||
portalPreviewUrl: computed('page', 'model.products.[]', 'changedProducts.[]', 'membersUtils.{isFreeChecked,isMonthlyChecked,isYearlyChecked}', 'settings.{portalName,portalButton,portalButtonIcon,portalButtonSignupText,portalButtonStyle,accentColor,portalPlans.[]}', function () {
|
||||
const options = this.getProperties(['page']);
|
||||
options.portalProducts = this.model.products?.filter((product) => {
|
||||
return product.get('visibility') === 'public' && product.get('type') === 'paid';
|
||||
return product.get('visibility') === 'public'
|
||||
&& product.get('active') === true
|
||||
&& product.get('type') === 'paid';
|
||||
}).map((product) => {
|
||||
return product.id;
|
||||
});
|
||||
|
@ -13,11 +13,13 @@ export default class ArchiveTierModalComponent extends Component {
|
||||
|
||||
@task({drop: true})
|
||||
*archiveTierTask() {
|
||||
const {product} = this.args.data;
|
||||
const {product, onArchive} = this.args.data;
|
||||
product.active = false;
|
||||
product.visibility = 'none';
|
||||
|
||||
try {
|
||||
yield product.save();
|
||||
onArchive?.();
|
||||
return product;
|
||||
} catch (error) {
|
||||
if (error) {
|
||||
|
@ -20,7 +20,8 @@ export default class ArchiveTierComponent extends Component {
|
||||
handleArchiveTier() {
|
||||
if (!this.product.isNew) {
|
||||
this.modals.open('modals/tiers/archive', {
|
||||
product: this.product
|
||||
product: this.product,
|
||||
onArchive: this.args.onArchive
|
||||
}, {
|
||||
className: 'fullscreen-modal fullscreen-modal-action fullscreen-modal-wide'
|
||||
});
|
||||
|
@ -266,10 +266,20 @@ export default class MembersAccessController extends Controller {
|
||||
let isMonthlyChecked = portalPlans.includes('monthly');
|
||||
let isYearlyChecked = portalPlans.includes('yearly');
|
||||
|
||||
const products = this.store.peekAll('product');
|
||||
const portalProducts = products?.filter((product) => {
|
||||
return product.get('visibility') === 'public'
|
||||
&& product.get('active') === true
|
||||
&& product.get('type') === 'paid';
|
||||
}).map((product) => {
|
||||
return product.id;
|
||||
});
|
||||
|
||||
const newUrl = new URL(this.membersUtils.getPortalPreviewUrl({
|
||||
button: false,
|
||||
monthlyPrice,
|
||||
yearlyPrice,
|
||||
portalProducts,
|
||||
currency: this.currency,
|
||||
isMonthlyChecked,
|
||||
isYearlyChecked,
|
||||
|
@ -169,6 +169,7 @@
|
||||
{{else}}
|
||||
{{#if (feature "multipleProducts")}}
|
||||
<GhMembershipProductsAlpha
|
||||
@updatePortalPreview={{this.updatePortalPreview}}
|
||||
@products={{this.paidProducts}}
|
||||
@confirmProductSave={{this.confirmProductSave}}
|
||||
/>
|
||||
|
Loading…
Reference in New Issue
Block a user