1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

Fix issues/pulls dependencies problems (#9842) (#9864)

* Fix issues/pulls dependencies problems

* fix swagger and api param name

* fix js
This commit is contained in:
Lunny Xiao
2020-01-20 01:56:57 +08:00
committed by techknowlogick
parent aa6ed1b7c1
commit 8add1dfacc
8 changed files with 57 additions and 26 deletions

View File

@@ -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"
@@ -129,6 +133,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 {
@@ -141,6 +155,7 @@ func SearchIssues(ctx *context.APIContext) {
LabelIDs: labelIDs,
SortType: "priorityrepo",
PriorityRepoID: ctx.QueryInt64("priority_repo_id"),
IsPull: isPull,
})
}