mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-15 21:57:22 +01:00
fix: removing party invitations
This commit is contained in:
@@ -120,11 +120,13 @@ describe('POST /groups/:groupId/removeMember/:memberId', () => {
|
||||
});
|
||||
|
||||
it('can remove other invites', async () => {
|
||||
expect(partyInvitedUser.invitations.party).to.not.be.empty;
|
||||
|
||||
await partyleader.post(`/groups/${party._id}/removeMember/${partyInvitedUser._id}`);
|
||||
|
||||
let invitedUserWithoutInvite = await partyInvitedUser.get('/user');
|
||||
|
||||
expect(_.findIndex(invitedUserWithoutInvite.invitations.party, {id: party._id})).eql(-1);
|
||||
expect(invitedUserWithoutInvite.invitations.party).to.be.empty;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -128,6 +128,10 @@ export async function createAndPopulateGroup (settings = {}) {
|
||||
|
||||
await Bluebird.all(invitationPromises);
|
||||
|
||||
await Bluebird.all(invitees.map((invitee) => {
|
||||
return invitee.sync();
|
||||
}));
|
||||
|
||||
return {
|
||||
groupLeader,
|
||||
group,
|
||||
|
||||
@@ -466,8 +466,8 @@ api.removeGroupMember = {
|
||||
removeFromArray(member.invitations.guilds, { id: group._id });
|
||||
}
|
||||
if (isInvited === 'party') {
|
||||
user.invitations.party = {};
|
||||
user.markModified('invitations.party');
|
||||
member.invitations.party = {};
|
||||
member.markModified('invitations.party');
|
||||
}
|
||||
} else {
|
||||
throw new NotFound(res.t('groupMemberNotFound'));
|
||||
@@ -514,6 +514,7 @@ async function _inviteByUUID (uuid, group, inviter, req, res) {
|
||||
}
|
||||
|
||||
userToInvite.invitations.party = {id: group._id, name: group.name, inviter: inviter._id};
|
||||
return userToInvite.save();
|
||||
}
|
||||
|
||||
let groupLabel = group.type === 'guild' ? 'Guild' : 'Party';
|
||||
|
||||
Reference in New Issue
Block a user