From b07290798796f4b254c23d38d52cb7fc58c3f8d6 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Fri, 9 Apr 2021 12:39:40 +0200 Subject: [PATCH] Fix `admin user list` (#15358) (#15359) * Fix `admin user list` (#15358) * fix routers/api/v1/repo/issue.go --- models/user.go | 4 ++-- routers/api/v1/repo/issue.go | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/models/user.go b/models/user.go index 098f6af2b374..67d910659334 100644 --- a/models/user.go +++ b/models/user.go @@ -239,10 +239,10 @@ func (u *User) GetEmail() string { return u.Email } -// GetAllUsers returns a slice of all users found in DB. +// GetAllUsers returns a slice of all individual users found in DB. func GetAllUsers() ([]*User, error) { users := make([]*User, 0) - return users, x.OrderBy("id").Find(&users) + return users, x.OrderBy("id").Where("type = ?", UserTypeIndividual).Find(&users) } // IsLocal returns true if user login type is LoginPlain. diff --git a/routers/api/v1/repo/issue.go b/routers/api/v1/repo/issue.go index 683a2a43b7db..79fea25f278c 100644 --- a/routers/api/v1/repo/issue.go +++ b/routers/api/v1/repo/issue.go @@ -141,7 +141,6 @@ func SearchIssues(ctx *context.APIContext) { keyword = "" } var issueIDs []int64 - var labelIDs []int64 if len(keyword) > 0 && len(repoIDs) > 0 { if issueIDs, err = issue_indexer.SearchIssuesByKeyword(repoIDs, keyword); err != nil { ctx.Error(http.StatusInternalServerError, "SearchIssuesByKeyword", err) @@ -176,7 +175,7 @@ func SearchIssues(ctx *context.APIContext) { // Only fetch the issues if we either don't have a keyword or the search returned issues // This would otherwise return all issues if no issues were found by the search. - if len(keyword) == 0 || len(issueIDs) > 0 || len(labelIDs) > 0 { + if len(keyword) == 0 || len(issueIDs) > 0 || len(includedLabelNames) > 0 { issuesOpt := &models.IssuesOptions{ ListOptions: models.ListOptions{ Page: ctx.QueryInt("page"),