mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 06:37:23 +01:00
Fix 9248: challenge creator should not automatically join their own challenge (#10383)
* fix(challenges): creator should not join challenge automatically * change behavior on the client side as well * update tests and fix membercount * update tests * fix tests
This commit is contained in:
@@ -43,6 +43,7 @@ describe('POST /challenges/:challengeId/join', () => {
|
||||
authorizedUser = populatedGroup.members[0];
|
||||
|
||||
challenge = await generateChallenge(groupLeader, group);
|
||||
await groupLeader.post(`/challenges/${challenge._id}/join`);
|
||||
});
|
||||
|
||||
it('returns an error when user doesn\'t have permissions to access the challenge', async () => {
|
||||
@@ -91,6 +92,7 @@ describe('POST /challenges/:challengeId/join', () => {
|
||||
});
|
||||
|
||||
it('increases memberCount of challenge', async () => {
|
||||
await challenge.sync();
|
||||
let oldMemberCount = challenge.memberCount;
|
||||
|
||||
await authorizedUser.post(`/challenges/${challenge._id}/join`);
|
||||
|
||||
Reference in New Issue
Block a user