mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 14:47:53 +01:00
fix(teams): fix fix fix
Removed testing banner Fixed a JS console error when assigning a user to a previously open task Fixed a potential abuse where user might be able to score someone else's task via API call Fixed an issue where finding tasks by alias could return tasks belonging to other users Fixed an issue that was appending the user's party ID to their list of Guilds Fixed an issue where group tasks were not receiving the default tag needed for filtering them on user's personal list
This commit is contained in:
@@ -205,7 +205,7 @@ TaskSchema.statics.findByIdOrAlias = async function findByIdOrAlias (
|
||||
return task;
|
||||
};
|
||||
|
||||
TaskSchema.statics.findMultipleByIdOrAlias = async function findByIdOrAlias (
|
||||
TaskSchema.statics.findMultipleByIdOrAlias = async function findMultipleByIdOrAlias (
|
||||
identifiers,
|
||||
userId,
|
||||
additionalQueries = {},
|
||||
@@ -226,6 +226,7 @@ TaskSchema.statics.findMultipleByIdOrAlias = async function findByIdOrAlias (
|
||||
});
|
||||
|
||||
if (ids.length > 0 && aliases.length > 0) {
|
||||
query.userId = userId;
|
||||
query.$or = [
|
||||
{ _id: { $in: ids } },
|
||||
{ alias: { $in: aliases } },
|
||||
@@ -233,6 +234,7 @@ TaskSchema.statics.findMultipleByIdOrAlias = async function findByIdOrAlias (
|
||||
} else if (ids.length > 0) {
|
||||
query._id = { $in: ids };
|
||||
} else if (aliases.length > 0) {
|
||||
query.userId = userId;
|
||||
query.alias = { $in: aliases };
|
||||
} else {
|
||||
throw new Error('No identifiers found.'); // Should be covered by the !identifiers check, but..
|
||||
|
||||
Reference in New Issue
Block a user