mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-14 21:27:23 +01:00
fix(teams): don't complain about move route when not moving
This commit is contained in:
@@ -815,7 +815,17 @@ api.moveTask = {
|
||||
|
||||
const group = await getGroupFromTaskAndUser(task, user);
|
||||
const challenge = await getChallengeFromTask(task);
|
||||
verifyTaskModification(task, user, group, challenge, res);
|
||||
if (task.group.id && !task.userId) {
|
||||
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');
|
||||
}
|
||||
} else {
|
||||
verifyTaskModification(task, user, group, challenge, res);
|
||||
}
|
||||
|
||||
if (task.type === 'todo' && task.completed) throw new BadRequest(res.t('cantMoveCompletedTodo'));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user