mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 14:47:53 +01:00
fix(teams): complete task sorting
This commit is contained in:
@@ -819,7 +819,7 @@ api.moveTask = {
|
||||
|
||||
if (task.type === 'todo' && task.completed) throw new BadRequest(res.t('cantMoveCompletedTodo'));
|
||||
|
||||
const owner = group || challenge || user;
|
||||
const owner = challenge || user;
|
||||
|
||||
// In memory updates
|
||||
const order = owner.tasksOrder[`${task.type}s`];
|
||||
@@ -846,7 +846,7 @@ api.moveTask = {
|
||||
// it cannot be updated in the pre update hook
|
||||
// See https://github.com/HabitRPG/habitica/pull/9321#issuecomment-354187666 for more info
|
||||
// Only users have a version.
|
||||
if (!group && !challenge) {
|
||||
if (!challenge) {
|
||||
owner._v += 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -326,8 +326,13 @@ function verifyTaskModification (task, user, group, challenge, res) {
|
||||
if (!task) {
|
||||
throw new NotFound(res.t('messageTaskNotFound'));
|
||||
} else if (task.group.id && !task.userId) {
|
||||
if (!group) throw new NotFound(res.t('groupNotFound'));
|
||||
if (canNotEditTasks(group, user)) throw new NotAuthorized(res.t('onlyGroupLeaderCanEditTasks'));
|
||||
if (!group || user.guilds.concat(user.party._id).indexOf(group._id) === -1) {
|
||||
throw new NotFound(res.t('groupNotFound'));
|
||||
}
|
||||
if (task.group.assignedUsers.length !== 0
|
||||
&& task.group.assignedUsers.indexOf(user._id) === -1) {
|
||||
throw new BadRequest('Use /group/:groupId/tasks/:taskId/move/to/:position route');
|
||||
}
|
||||
|
||||
// If the task belongs to a challenge make sure the user has rights
|
||||
} else if (task.challenge.id && !task.userId) {
|
||||
|
||||
Reference in New Issue
Block a user