mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-07-13 15:38:59 +00:00
Fix user receiving Joined Challenged achievement when creating a challenge (#10559)
* Fix joinedChallenge achievement being awarded when creating a challenge * Modify test to check that achievement is not awarded for creating a challenge
This commit is contained in:
parent
774a1d9a96
commit
5566460541
2 changed files with 2 additions and 4 deletions
|
|
@ -304,14 +304,14 @@ describe('POST /challenges', () => {
|
|||
expect(groupLeader.challenges.length).to.equal(0);
|
||||
});
|
||||
|
||||
it('awards achievement if this is creator\'s first challenge', async () => {
|
||||
it('does not award joinedChallenge achievement for creating a challenge', async () => {
|
||||
await groupLeader.post('/challenges', {
|
||||
group: group._id,
|
||||
name: 'Test Challenge',
|
||||
shortName: 'TC Label',
|
||||
});
|
||||
groupLeader = await groupLeader.sync();
|
||||
expect(groupLeader.achievements.joinedChallenge).to.be.true;
|
||||
expect(groupLeader.achievements.joinedChallenge).to.not.be.true;
|
||||
});
|
||||
|
||||
it('sets summary to challenges name when not supplied', async () => {
|
||||
|
|
|
|||
|
|
@ -79,8 +79,6 @@ export async function createChallenge (user, req, res) {
|
|||
let challengeValidationErrors = challenge.validateSync();
|
||||
if (challengeValidationErrors) throw challengeValidationErrors;
|
||||
|
||||
addUserJoinChallengeNotification(user);
|
||||
|
||||
let results = await Promise.all([challenge.save({
|
||||
validateBeforeSave: false, // already validated
|
||||
}), group.save(), user.save()]);
|
||||
|
|
|
|||
Loading…
Reference in a new issue