fix(tasks): include tasks with deleted parents in subtask-expanded queries
When expand[]=subtasks is used, the LEFT JOIN on task_relations filters
out same-project subtasks. If a parent task was deleted, the JOIN
produces NULL for parent_tasks.id/project_id, and since NULL != value
evaluates to NULL (not TRUE) in SQL, these tasks were incorrectly
excluded.
Add builder.IsNull{"parent_tasks.id"} to the OR condition so tasks
whose parent was deleted are still included in results.
This commit is contained in:
parent
132187e451
commit
e7b693c788
|
|
@ -369,6 +369,7 @@ func (d *dbTaskSearcher) Search(opts *taskSearchOptions) (tasks []*Task, totalCo
|
|||
if expandSubtasks {
|
||||
cond = builder.And(cond, builder.Or(
|
||||
builder.IsNull{"task_relations.id"},
|
||||
builder.IsNull{"parent_tasks.id"},
|
||||
builder.Expr("parent_tasks.project_id != tasks.project_id"),
|
||||
))
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue