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:
Matteo Pagliazzi
2018-05-25 12:03:39 +02:00
committed by GitHub
parent 9194e8226d
commit 6ef45a7fd2
33 changed files with 76 additions and 15 deletions

View File

@@ -82,12 +82,10 @@ export async function createChallenge (user, req, res) {
addUserJoinChallengeNotification(user);
let results = await Promise.all([challenge.save({
validateBeforeSave: false, // already validate
}), group.save()]);
validateBeforeSave: false, // already validated
}), group.save(), user.save()]);
let savedChal = results[0];
await savedChal.syncToUser(user); // (it also saves the user)
return {savedChal, group};
}