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, show_closed:project.show_closed,
render: false render: false
} }
const resp = await fetch(url,{ const resp = await post(url,data);
credentials : 'include',
method : 'POST',
body : JSON.stringify(data)
});
if (resp.ok){ if (resp.ok){
tasks = {}; tasks = {};
est_time.sum = 0; est_time.sum = 0;
+2 -1
View File
@@ -80,7 +80,8 @@
const url = api('task/list'); const url = api('task/list');
const data = { const data = {
parent_task_id : +task.id, parent_task_id : +task.id,
show_closed : show_closed show_closed : show_closed,
render : false
}; };
if (task.show_closed) data.show_closed = true; if (task.show_closed) data.show_closed = true;
const resp = await post(url,data); 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 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 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 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 (isSet(projectId)) {
if (parentTaskId == null) { if (parentTaskId == null) {
var list = taskDb.listRootTasks(projectId, user, showClosed); var list = taskDb.listRootTasks(projectId, user, showClosed);
@@ -488,11 +488,13 @@ public class TaskModule extends BaseHandler implements TaskService {
projectTasks = addTags(projectTasks, tags); projectTasks = addTags(projectTasks, tags);
return sendContent(ex, mapTasks(projectTasks, render)); return sendContent(ex, mapTasks(projectTasks, render));
} }
if (isSet(parentTaskId)) return sendContent(ex, mapValues(taskDb.listChildrenOf(parentTaskId, user, showClosed))); Map<Long, Task> tasks;
var taskIds = json.has(IDS) && json.get(IDS) instanceof JSONArray ids ? ids.toList().stream().map(Object::toString).map(Long::parseLong).toList() : null; if (!isSet(parentTaskId)) {
var tasks = taskDb.load(taskIds); 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 sendContent(ex, mapTasks(tasks,render)); if (!isSet(taskIds)) return sendEmptyResponse(HTTP_NOT_IMPLEMENTED,ex);
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) { private Map<Long, Task> addTags(Map<Long, Task> taskList, Map<Long, ? extends Collection<String>> tags) {