Keep existing Mystery Items and Hourglasses when adding to group - fixes 8643 (#8745)

* Modified addSubToGroupUser to save existing mysteryItems and trinkets from an expired subscription
Added unit test

* fix eslint error
This commit is contained in:
joe-salomon
2017-06-07 09:59:09 -07:00
committed by Sabe Jones
parent 5cd30b430d
commit befacca457
2 changed files with 32 additions and 1 deletions
+5 -1
View File
@@ -112,8 +112,8 @@ api.addSubToGroupUser = async function addSubToGroupUser (member, group) {
},
};
let memberPlan = member.purchased.plan;
if (member.isSubscribed()) {
let memberPlan = member.purchased.plan;
let customerHasCancelledGroupPlan = memberPlan.customerId === this.constants.GROUP_PLAN_CUSTOMER_ID && !member.hasNotCancelled();
let ignorePaymentPlan = paymentMethodsToIgnore.indexOf(memberPlan.paymentMethod) !== -1;
let ignoreCustomerId = customerIdsToIgnore.indexOf(memberPlan.customerId) !== -1;
@@ -154,6 +154,10 @@ api.addSubToGroupUser = async function addSubToGroupUser (member, group) {
}).value();
}
// save unused hourglass and mystery items
plan.consecutive.trinkets = memberPlan.consecutive.trinkets;
plan.mysteryItems = memberPlan.mysteryItems;
member.purchased.plan = plan;
member.items.mounts['Jackalope-RoyalPurple'] = true;