Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New API routes added #5594

Merged
merged 17 commits into from
Jan 23, 2019
4 changes: 2 additions & 2 deletions models/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -1362,13 +1362,13 @@ func SearchUsers(opts *SearchUserOptions) (users []*User, _ int64, _ error) {

//SearchUsersAPI takes options i.e keyword and part of user name to search
//it returns all the results found and the number of total results.
func SearchUsersAPI(opts *SearchUserOptions) (users []*User, _ int64, _ error) {
func SearchUsersAPI(opts *SearchUserOptions) (_ []*User, _ int64, _ error) {
lafriks marked this conversation as resolved.
Show resolved Hide resolved
cond := opts.toConds()
count, err := x.Where(cond).Count(new(User))
if err != nil {
return nil, 0, fmt.Errorf("Count: %v", err)
}
users = make([]*User, 0, count)
users := make([]*User, 0, count)
return users, count, x.Where(cond).OrderBy(opts.OrderBy.String()).Find(&users)
}

Expand Down
1 change: 0 additions & 1 deletion routers/api/v1/admin/org.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ func GetAllOrgs(ctx *context.APIContext) {
users, _, err := models.SearchUsersAPI(&models.SearchUserOptions{
Type: models.UserTypeOrganization,
OrderBy: models.SearchOrderByAlphabetically,
Keyword: "",
})
if err != nil {
ctx.Error(500, "SearchOrganizations", err)
Expand Down
1 change: 0 additions & 1 deletion routers/api/v1/admin/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,6 @@ func GetAllUsers(ctx *context.APIContext) {
users, _, err := models.SearchUsersAPI(&models.SearchUserOptions{
Type: models.UserTypeIndividual,
OrderBy: models.SearchOrderByAlphabetically,
Keyword: "",
})
if err != nil {
ctx.Error(500, "SearchUsers", err)
Expand Down