Fix user's total count in search (#40415)
This commit is contained in:
@@ -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
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user