Merge branch 'bugfix-extramonths-lost-when-subscription-terminated' of https://github.com/hamboomger/habitica into hamboomger-bugfix-extramonths-lost-when-subscription-terminated

This commit is contained in:
Matteo Pagliazzi
2020-04-20 23:30:19 +02:00
11 changed files with 193 additions and 38 deletions

View File

@@ -863,11 +863,6 @@ api.leaveGroup = {
if (guildIndex >= 0) user.guilds.splice(guildIndex, 1);
}
const isMemberOfGroupPlan = await user.isMemberOfGroupPlan();
if (!isMemberOfGroupPlan) {
await payments.cancelGroupSubscriptionForUser(user, group);
}
if (group.hasNotCancelled()) await group.updateGroupPlan(true);
res.respond(200, {});
},
@@ -1317,7 +1312,7 @@ api.getGroupPlans = {
.select('leaderOnly leader purchased name managers')
.exec();
const groupPlans = groups.filter(group => group.isSubscribed());
const groupPlans = groups.filter(group => group.hasActiveGroupPlan());
res.respond(200, groupPlans);
},