mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-07-31 19:20:25 +00:00
challenges: chal creator auto-joins
This commit is contained in:
parent
baf52db594
commit
287beb363f
1 changed files with 1 additions and 0 deletions
|
|
@ -154,6 +154,7 @@ api.create = function(req, res){
|
|||
async.waterfall(waterfall, function(err){
|
||||
if (err) return res.json(401, {err:err});
|
||||
var challenge = new Challenge(req.body); // FIXME sanitize
|
||||
challenge.members.push(user._id);
|
||||
challenge.save(function(err, saved){
|
||||
if (err) return res.json(500, {err:err});
|
||||
Group.update({_id:saved.group}, {$addToSet:{challenges:saved._id}}) // fixme error-check, and also better to do in middleware?
|
||||
|
|
|
|||
Loading…
Reference in a new issue