working on user-defined project states and task states
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
@@ -56,11 +56,12 @@
|
||||
let task = dragged;
|
||||
dragged = null;
|
||||
highlight = {};
|
||||
console.log(state);
|
||||
//console.log(`dropped ${task.name} (of ${task.assignee} /state: ${task.status}) → (uid: ${user_id}/state: ${state})`);
|
||||
|
||||
if (task.assignee == user_id && task.status == state) return; // no change
|
||||
let patch = {members:{},status:+state}
|
||||
patch.members[user_id] = 'ASSIGNEE';
|
||||
|
||||
//console.log('sending patch:',patch)
|
||||
const url = api(`task/${task.id}`);
|
||||
const resp = await fetch(url,{
|
||||
credentials : 'include',
|
||||
@@ -68,12 +69,14 @@
|
||||
body : JSON.stringify(patch)
|
||||
});
|
||||
if (resp.ok){
|
||||
//console.log('task tree before update:',tasks);
|
||||
delete tasks[task.assignee][task.status][task.id]
|
||||
if (!tasks[user_id]) tasks[user_id] = {}
|
||||
if (!tasks[user_id][state]) tasks[user_id][state] = {}
|
||||
tasks[user_id][state][task.id] = task;
|
||||
task.assignee = user_id;
|
||||
task.status = {code:state,name:states[state]};
|
||||
task.status = state;
|
||||
//console.log('task tree after update:',tasks);
|
||||
error = null;
|
||||
} else {
|
||||
error = await resp.text();
|
||||
|
||||
Reference in New Issue
Block a user