mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-15 05:37:22 +01:00
fix loading owned messages (#11147)
This commit is contained in:
@@ -364,12 +364,14 @@ api.getUserChallenges = {
|
||||
$and: [{$or: orOptions}],
|
||||
};
|
||||
|
||||
if (owned && owned === 'not_owned') {
|
||||
query.$and.push({leader: {$ne: user._id}});
|
||||
}
|
||||
if (owned) {
|
||||
if (owned === 'not_owned') {
|
||||
query.$and = [{leader: {$ne: user._id}}];
|
||||
}
|
||||
|
||||
if (owned && owned === 'owned') {
|
||||
query.$and.push({leader: user._id});
|
||||
if (owned === 'owned') {
|
||||
query.$and = [{leader: user._id}];
|
||||
}
|
||||
}
|
||||
|
||||
if (req.query.search) {
|
||||
@@ -400,7 +402,6 @@ api.getUserChallenges = {
|
||||
// .populate('leader', nameFields)
|
||||
const challenges = await mongoQuery.exec();
|
||||
|
||||
|
||||
let resChals = challenges.map(challenge => challenge.toJSON());
|
||||
|
||||
resChals = _.orderBy(resChals, [challenge => {
|
||||
|
||||
Reference in New Issue
Block a user