mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05:00
Fixed rollback of selected plans when leaving portal settings
no issue - the original `portalPlans` array was being modified by reference which was throwing off Ember Data's change tracking - switched to always creating a new plans array before any modifications take place
This commit is contained in:
parent
49b83add43
commit
6a6f50cf15
2 changed files with 6 additions and 4 deletions
|
@ -172,13 +172,14 @@ export default class GhLaunchWizardSetPricingComponent extends Component {
|
|||
}
|
||||
|
||||
updateAllowedPlan(plan, isChecked) {
|
||||
const allowedPlans = this.settings.get('portalPlans') || [];
|
||||
const portalPlans = this.settings.get('portalPlans') || [];
|
||||
const allowedPlans = [...portalPlans];
|
||||
|
||||
if (!isChecked) {
|
||||
this.settings.set('portalPlans', allowedPlans.filter(p => p !== plan));
|
||||
} else {
|
||||
allowedPlans.push(plan);
|
||||
this.settings.set('portalPlans', [...allowedPlans]);
|
||||
this.settings.set('portalPlans', allowedPlans);
|
||||
}
|
||||
|
||||
this.updatePreviewUrl();
|
||||
|
|
|
@ -251,13 +251,14 @@ export default ModalComponent.extend({
|
|||
},
|
||||
|
||||
updateAllowedPlan(plan, isChecked) {
|
||||
const allowedPlans = this.settings.get('portalPlans') || [];
|
||||
const portalPlans = this.settings.get('portalPlans') || [];
|
||||
const allowedPlans = [...portalPlans];
|
||||
|
||||
if (!isChecked) {
|
||||
this.settings.set('portalPlans', allowedPlans.filter(p => p !== plan));
|
||||
} else {
|
||||
allowedPlans.push(plan);
|
||||
this.settings.set('portalPlans', [...allowedPlans]);
|
||||
this.settings.set('portalPlans', allowedPlans);
|
||||
}
|
||||
},
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue