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:
parent
b2f3a23cb3
commit
68d4dcd7e6
@ -368,18 +368,20 @@ func getUserProjectsStatement(parentProjectIDs []int64, userID int64, search str
|
|||||||
}
|
}
|
||||||
|
|
||||||
var parentCondition builder.Cond
|
var parentCondition builder.Cond
|
||||||
parentCondition = builder.Or(
|
if search == "" {
|
||||||
builder.IsNull{"l.parent_project_id"},
|
parentCondition = builder.Or(
|
||||||
builder.Eq{"l.parent_project_id": 0},
|
builder.IsNull{"l.parent_project_id"},
|
||||||
// else check for shared sub projects with a parent
|
builder.Eq{"l.parent_project_id": 0},
|
||||||
builder.And(
|
// else check for shared sub projects with a parent
|
||||||
builder.Or(
|
builder.And(
|
||||||
builder.NotNull{"tm2.user_id"},
|
builder.Or(
|
||||||
builder.NotNull{"ul.user_id"},
|
builder.NotNull{"tm2.user_id"},
|
||||||
|
builder.NotNull{"ul.user_id"},
|
||||||
|
),
|
||||||
|
builder.NotNull{"l.parent_project_id"},
|
||||||
),
|
),
|
||||||
builder.NotNull{"l.parent_project_id"},
|
)
|
||||||
),
|
}
|
||||||
)
|
|
||||||
projectCol := "id"
|
projectCol := "id"
|
||||||
if len(parentProjectIDs) > 0 {
|
if len(parentProjectIDs) > 0 {
|
||||||
parentCondition = builder.In("l.parent_project_id", parentProjectIDs)
|
parentCondition = builder.In("l.parent_project_id", parentProjectIDs)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user