mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-16 06:07:21 +01: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:
committed by
Matteo Pagliazzi
parent
774a1d9a96
commit
5566460541
@@ -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()]);
|
||||
|
||||
Reference in New Issue
Block a user