Refined tiers list to switch to active list on unarchive

refs https://github.com/TryGhost/Team/issues/1252

- on unarchiving a tier, we switch back to active tier list instead of staying back on archived list
This commit is contained in:
Rishabh 2022-02-02 16:21:21 +05:30
parent b4c3e1ae40
commit 498efd00cb
6 changed files with 14 additions and 5 deletions

View File

@ -29,6 +29,7 @@
<GhProductCard
@product={{product}}
@openEditProduct={{this.openEditProduct}}
@onUnarchive={{this.onUnarchive}}
/>
{{/each}}
{{#if (eq this.type "active" )}}

View File

@ -57,6 +57,11 @@ export default class extends Component {
this.showProductModal = true;
}
@action
async onUnarchive() {
this.type = 'active';
}
@action
async openNewProduct() {
this.productModel = this.store.createRecord('product');

View File

@ -76,7 +76,10 @@
</li>
{{#if (eq this.product.type "paid" )}}
<li>
<Settings::Members::ArchiveTier @product={{this.product}} />
<Settings::Members::ArchiveTier
@product={{this.product}}
@onUnarchive={{@onUnarchive}}
/>
</li>
{{/if}}
</GhDropdown>

View File

@ -18,7 +18,6 @@ export default class ArchiveTierModalComponent extends Component {
try {
yield product.save();
return product;
} catch (error) {
if (error) {

View File

@ -13,12 +13,12 @@ export default class UnarchiveTierModalComponent extends Component {
@task({drop: true})
*unarchiveTask() {
const {product} = this.args.data;
const {product, onUnarchive} = this.args.data;
product.active = true;
try {
yield product.save();
onUnarchive?.();
return product;
} catch (error) {
if (error) {

View File

@ -31,7 +31,8 @@ export default class ArchiveTierComponent extends Component {
handleUnarchiveTier() {
if (!this.product.isNew) {
this.modals.open('modals/tiers/unarchive', {
product: this.product
product: this.product,
onUnarchive: this.args.onUnarchive
}, {
className: 'fullscreen-modal fullscreen-modal-action fullscreen-modal-wide'
});