mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-07-14 07:52:15 +00:00
Group plans add mount (#8548)
* Added jakcalop mount to group plan members * Changed pet assignment to mount
This commit is contained in:
parent
61db283473
commit
38b894db56
2 changed files with 5 additions and 3 deletions
|
|
@ -142,7 +142,6 @@ describe('Purchasing a subscription for group', () => {
|
|||
data.groupId = group._id;
|
||||
|
||||
await api.createSubscription(data);
|
||||
|
||||
let updatedLeader = await User.findById(user._id).exec();
|
||||
|
||||
expect(updatedLeader.purchased.plan.planId).to.eql('group_plan_auto');
|
||||
|
|
@ -154,6 +153,8 @@ describe('Purchasing a subscription for group', () => {
|
|||
expect(updatedLeader.purchased.plan.dateTerminated).to.eql(null);
|
||||
expect(updatedLeader.purchased.plan.lastBillingDate).to.not.exist;
|
||||
expect(updatedLeader.purchased.plan.dateCreated).to.exist;
|
||||
|
||||
expect(updatedLeader.items.mounts['Jackalope-RoyalPurple']).to.be.true;
|
||||
});
|
||||
|
||||
it('sends an email to members of group', async () => {
|
||||
|
|
|
|||
|
|
@ -56,9 +56,9 @@ function _dateDiff (earlyDate, lateDate) {
|
|||
api.addSubscriptionToGroupUsers = async function addSubscriptionToGroupUsers (group) {
|
||||
let members;
|
||||
if (group.type === 'guild') {
|
||||
members = await User.find({guilds: group._id}).select('_id purchased').exec();
|
||||
members = await User.find({guilds: group._id}).select('_id purchased items').exec();
|
||||
} else {
|
||||
members = await User.find({'party._id': group._id}).select('_id purchased').exec();
|
||||
members = await User.find({'party._id': group._id}).select('_id purchased items').exec();
|
||||
}
|
||||
|
||||
let promises = members.map((member) => {
|
||||
|
|
@ -135,6 +135,7 @@ api.addSubToGroupUser = async function addSubToGroupUser (member, group) {
|
|||
}
|
||||
|
||||
member.purchased.plan = plan;
|
||||
member.items.mounts['Jackalope-RoyalPurple'] = true;
|
||||
|
||||
data.user = member;
|
||||
await this.createSubscription(data);
|
||||
|
|
|
|||
Loading…
Reference in a new issue