fix(projects): don't limit results to top-level projects when searching

Resolves https://github.com/go-vikunja/api/issues/82
This commit is contained in:
kolaente 2023-09-07 10:56:59 +02:00
parent b2f3a23cb3
commit 68d4dcd7e6
Signed by untrusted user: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 13 additions and 11 deletions

View File

@ -368,6 +368,7 @@ func getUserProjectsStatement(parentProjectIDs []int64, userID int64, search str
}
var parentCondition builder.Cond
if search == "" {
parentCondition = builder.Or(
builder.IsNull{"l.parent_project_id"},
builder.Eq{"l.parent_project_id": 0},
@ -380,6 +381,7 @@ func getUserProjectsStatement(parentProjectIDs []int64, userID int64, search str
builder.NotNull{"l.parent_project_id"},
),
)
}
projectCol := "id"
if len(parentProjectIDs) > 0 {
parentCondition = builder.In("l.parent_project_id", parentProjectIDs)