mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-15 05:37:22 +01:00
Drag challenge tasks (#12204)
* Allow challenge tasks to be draggable by leaders and admins * Drag challenge tasks, ensure they're ordered * Ensure group tasks are ordered properly, make draggable * Add tests, fix broken tests * Resolve merge conflict * Remove console.log() * Address code review comments * Code review fixes * Fix lint * Fix importing * taskManager * Lint * Fix collapseChecklist test Co-authored-by: Sabe Jones <sabrecat@gmail.com>
This commit is contained in:
@@ -8,10 +8,13 @@ import {
|
||||
NotAuthorized,
|
||||
} from '../../../libs/errors';
|
||||
import {
|
||||
canNotEditTasks,
|
||||
createTasks,
|
||||
getTasks,
|
||||
} from '../../../libs/tasks';
|
||||
import {
|
||||
moveTask,
|
||||
} from '../../../libs/taskManager';
|
||||
} from '../../../libs/tasks/utils';
|
||||
import { handleSharedCompletion } from '../../../libs/groupTasks';
|
||||
import apiError from '../../../libs/apiError';
|
||||
import logger from '../../../libs/logger';
|
||||
@@ -22,14 +25,6 @@ const types = Tasks.tasksTypes.map(type => `${type}s`);
|
||||
// _allCompletedTodos is currently in BETA and is likely to be removed in future
|
||||
types.push('completedTodos', '_allCompletedTodos');
|
||||
|
||||
// @TODO abstract this snipped (also see api-v3/tasks.js)
|
||||
function canNotEditTasks (group, user, assignedUserId) {
|
||||
const isNotGroupLeader = group.leader !== user._id;
|
||||
const isManager = Boolean(group.managers[user._id]);
|
||||
const userIsAssigningToSelf = Boolean(assignedUserId && user._id === assignedUserId);
|
||||
return isNotGroupLeader && !isManager && !userIsAssigningToSelf;
|
||||
}
|
||||
|
||||
const api = {};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user