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