mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Fix user's total count in search (#40415)
This commit is contained in:
parent
665055dbbc
commit
a1230f44dc
@ -654,6 +654,18 @@ func SearchUsers(ctx context.Context, query *models.SearchUsersQuery) error {
|
|||||||
countSess.Where(strings.Join(whereConditions, " AND "), whereParams...)
|
countSess.Where(strings.Join(whereConditions, " AND "), whereParams...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for _, filter := range query.Filters {
|
||||||
|
if jc := filter.JoinCondition(); jc != nil {
|
||||||
|
countSess.Join(jc.Operator, jc.Table, jc.Params)
|
||||||
|
}
|
||||||
|
if ic := filter.InCondition(); ic != nil {
|
||||||
|
countSess.In(ic.Condition, ic.Params)
|
||||||
|
}
|
||||||
|
if wc := filter.WhereCondition(); wc != nil {
|
||||||
|
countSess.Where(wc.Condition, wc.Params)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
count, err := countSess.Count(&user)
|
count, err := countSess.Count(&user)
|
||||||
query.Result.TotalCount = count
|
query.Result.TotalCount = count
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user