mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
WIP(teams): show open tasks on user view
This commit is contained in:
@@ -385,7 +385,7 @@ api.getUserTasks = {
|
||||
url: '/tasks/user',
|
||||
middlewares: [authWithHeaders({
|
||||
// Some fields (including _id, preferences) are always loaded (see middlewares/auth)
|
||||
userFieldsToInclude: ['tasksOrder'],
|
||||
userFieldsToInclude: ['guilds', 'party', 'tasksOrder'],
|
||||
})],
|
||||
async handler (req, res) {
|
||||
const types = Tasks.tasksTypes.map(type => `${type}s`);
|
||||
|
||||
@@ -355,10 +355,10 @@ api.taskNeedsWork = {
|
||||
if (['daily', 'todo'].indexOf(task.type) === -1) {
|
||||
throw new BadRequest('Cannot roll back use of Habits or Rewards.');
|
||||
}
|
||||
if (!task.group.assignedUsersDetail || !task.group.assignedUsersDetail[assignedUserId]) {
|
||||
throw new BadRequest('User not assigned to this task.');
|
||||
}
|
||||
if (!task.group.assignedUsersDetail[assignedUserId].completed) {
|
||||
if (
|
||||
(task.group.completedBy.userId && task.group.completedBy.userId !== assignedUserId)
|
||||
|| (task.group.assignedUsersDetail && !(task.group.assignedUsersDetail[assignedUserId]
|
||||
&& task.group.assignedUsersDetail[assignedUserId].completed))) {
|
||||
throw new BadRequest('Task not completed by this user.');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user