mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 15:48:04 +01:00
add note about populate + match in chatc
This commit is contained in:
@@ -121,16 +121,17 @@ api.postChat = function(req, res, next) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async.series([
|
async.series([
|
||||||
function(cb){
|
function(cb){group.save(cb)},
|
||||||
group.save(cb)
|
|
||||||
},
|
|
||||||
function(cb){
|
function(cb){
|
||||||
Group.findById(group._id).populate('members', partyFields).exec(cb);
|
Group.findById(group._id).populate('members', partyFields).exec(cb);
|
||||||
}
|
}
|
||||||
], function(err, results){
|
], function(err, results){
|
||||||
if (err) return res.json(500, {err:err});
|
if (err) return res.json(500, {err:err});
|
||||||
|
|
||||||
|
// TODO This is less efficient, but see https://github.com/lefnire/habitrpg/commit/41255dc#commitcomment-4014583
|
||||||
var saved = results[1];
|
var saved = results[1];
|
||||||
saved.members = _.filter(saved.members, function(m){return m._id != user._id});
|
saved.members = _.filter(saved.members, function(m){return m._id != user._id});
|
||||||
|
|
||||||
res.json(saved);
|
res.json(saved);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user