fixed code so it works for task list in project view

Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
2026-10-08 01:28:00 +02:00
parent e41932cb9f
commit d2d534cb14
3 changed files with 11 additions and 12 deletions
+1 -5
View File
@@ -111,11 +111,7 @@
show_closed:project.show_closed,
render: false
}
const resp = await fetch(url,{
credentials : 'include',
method : 'POST',
body : JSON.stringify(data)
});
const resp = await post(url,data);
if (resp.ok){
tasks = {};
est_time.sum = 0;
+2 -1
View File
@@ -80,7 +80,8 @@
const url = api('task/list');
const data = {
parent_task_id : +task.id,
show_closed : show_closed
show_closed : show_closed,
render : false
};
if (task.show_closed) data.show_closed = true;
const resp = await post(url,data);
@@ -475,7 +475,7 @@ public class TaskModule extends BaseHandler implements TaskService {
var noIndex = json.has(NO_INDEX) && json.get(NO_INDEX) instanceof Boolean bool ? bool : false;
var projectId = json.has(PROJECT_ID) && json.get(PROJECT_ID) instanceof Number number ? number.longValue() : null;
var parentTaskId = json.has(PARENT_TASK_ID) && json.get(PARENT_TASK_ID) instanceof Number number ? number.longValue() : null;
var render = !json.has(RENDER) || !(json.get(RENDER) instanceof Boolean bool) || bool;
var render = !json.has(RENDER) || !(json.get(RENDER) instanceof Boolean bool) || bool;
if (isSet(projectId)) {
if (parentTaskId == null) {
var list = taskDb.listRootTasks(projectId, user, showClosed);
@@ -488,11 +488,13 @@ public class TaskModule extends BaseHandler implements TaskService {
projectTasks = addTags(projectTasks, tags);
return sendContent(ex, mapTasks(projectTasks, render));
}
if (isSet(parentTaskId)) return sendContent(ex, mapValues(taskDb.listChildrenOf(parentTaskId, user, showClosed)));
var taskIds = json.has(IDS) && json.get(IDS) instanceof JSONArray ids ? ids.toList().stream().map(Object::toString).map(Long::parseLong).toList() : null;
var tasks = taskDb.load(taskIds);
if (isSet(taskIds)) return sendContent(ex, mapTasks(tasks,render));
return sendEmptyResponse(HTTP_NOT_IMPLEMENTED, ex);
Map<Long, Task> tasks;
if (!isSet(parentTaskId)) {
var taskIds = json.has(IDS) && json.get(IDS) instanceof JSONArray ids ? ids.toList().stream().map(Object::toString).map(Long::parseLong).toList() : null;
if (!isSet(taskIds)) return sendEmptyResponse(HTTP_NOT_IMPLEMENTED,ex);
tasks = taskDb.load(taskIds);
} else tasks = taskDb.listChildrenOf(parentTaskId,user,showClosed);
return sendContent(ex, mapTasks(tasks,render));
}
private Map<Long, Task> addTags(Map<Long, Task> taskList, Map<Long, ? extends Collection<String>> tags) {