diff options
author | 6543 <6543@obermui.de> | 2020-01-12 11:20:49 +0100 |
---|---|---|
committer | zeripath <art27@cantab.net> | 2020-01-12 10:20:49 +0000 |
commit | dbeef6bb0268460f22ed6158704aa88002bf5e0c (patch) | |
tree | ee51229eca94dc5792edccc7788ff8b4db04226b /routers/api/v1/repo | |
parent | fec35440dbba92644ba02c80bb204daa0bf435b5 (diff) | |
download | gitea-dbeef6bb0268460f22ed6158704aa88002bf5e0c.tar.gz gitea-dbeef6bb0268460f22ed6158704aa88002bf5e0c.zip |
[BugFix] [API] /repos/issues/search (#9698) (#9724)
* fix
* fix options
* add TEST
Co-authored-by: Antoine GIRARD <sapk@users.noreply.github.com>
Co-authored-by: Antoine GIRARD <sapk@users.noreply.github.com>
Diffstat (limited to 'routers/api/v1/repo')
-rw-r--r-- | routers/api/v1/repo/issue.go | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/routers/api/v1/repo/issue.go b/routers/api/v1/repo/issue.go index ad82d53e7a..69b8a36995 100644 --- a/routers/api/v1/repo/issue.go +++ b/routers/api/v1/repo/issue.go @@ -67,20 +67,24 @@ func SearchIssues(ctx *context.APIContext) { // find repos user can access (for issue search) repoIDs := make([]int64, 0) + opts := &models.SearchRepoOptions{ + PageSize: 15, + Private: false, + AllPublic: true, + TopicOnly: false, + Collaborate: util.OptionalBoolNone, + UserIsAdmin: ctx.IsUserSiteAdmin(), + OrderBy: models.SearchOrderByRecentUpdated, + } + if ctx.IsSigned { + opts.Private = true + opts.AllLimited = true + opts.UserID = ctx.User.ID + } issueCount := 0 for page := 1; ; page++ { - repos, count, err := models.SearchRepositoryByName(&models.SearchRepoOptions{ - Page: page, - PageSize: 15, - Private: true, - Keyword: "", - OwnerID: ctx.User.ID, - TopicOnly: false, - Collaborate: util.OptionalBoolNone, - UserIsAdmin: ctx.IsUserSiteAdmin(), - UserID: ctx.User.ID, - OrderBy: models.SearchOrderByRecentUpdated, - }) + opts.Page = page + repos, count, err := models.SearchRepositoryByName(opts) if err != nil { ctx.Error(http.StatusInternalServerError, "SearchRepositoryByName", err) return |