aboutsummaryrefslogtreecommitdiffstats
path: root/routers/api/v1/repo/issue.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2020-01-19 14:43:38 +0800
committerGitHub <noreply@github.com>2020-01-19 14:43:38 +0800
commitf540d0ac87fe776e71c5caeba20049f46a667efe (patch)
tree71c115e7b4081ac013c92cfa4e8ad88c43e9dbaa /routers/api/v1/repo/issue.go
parent0641965860bc5ebcb1c85067976099986d0136c6 (diff)
downloadgitea-f540d0ac87fe776e71c5caeba20049f46a667efe.tar.gz
gitea-f540d0ac87fe776e71c5caeba20049f46a667efe.zip
Fix issues/pulls dependencies problems (#9842)
* Fix issues/pulls dependencies problems * fix swagger and api param name * fix js
Diffstat (limited to 'routers/api/v1/repo/issue.go')
-rw-r--r--routers/api/v1/repo/issue.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/routers/api/v1/repo/issue.go b/routers/api/v1/repo/issue.go
index 1219ef2e41..2463586e71 100644
--- a/routers/api/v1/repo/issue.go
+++ b/routers/api/v1/repo/issue.go
@@ -51,6 +51,10 @@ func SearchIssues(ctx *context.APIContext) {
// description: repository to prioritize in the results
// type: integer
// format: int64
+ // - name: type
+ // in: query
+ // description: filter by type (issues / pulls) if set
+ // type: string
// responses:
// "200":
// "$ref": "#/responses/IssueList"
@@ -128,6 +132,16 @@ func SearchIssues(ctx *context.APIContext) {
}
}
+ var isPull util.OptionalBool
+ switch ctx.Query("type") {
+ case "pulls":
+ isPull = util.OptionalBoolTrue
+ case "issues":
+ isPull = util.OptionalBoolFalse
+ default:
+ isPull = util.OptionalBoolNone
+ }
+
// 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 {
@@ -140,6 +154,7 @@ func SearchIssues(ctx *context.APIContext) {
LabelIDs: labelIDs,
SortType: "priorityrepo",
PriorityRepoID: ctx.QueryInt64("priority_repo_id"),
+ IsPull: isPull,
})
}