aboutsummaryrefslogtreecommitdiffstats
path: root/routers/api/v1/repo/issue.go
diff options
context:
space:
mode:
authorEthan Koenig <etk39@cornell.edu>2017-01-24 21:43:02 -0500
committerLunny Xiao <xiaolunwen@gmail.com>2017-01-25 10:43:02 +0800
commit833f8b94c2cd88277eba32984594aad2b7b2b05d (patch)
treead197af65043b654f0c64702db707b9335568bd7 /routers/api/v1/repo/issue.go
parent8bc431952f4ae76559054c3a9f41804b145d9230 (diff)
downloadgitea-833f8b94c2cd88277eba32984594aad2b7b2b05d.tar.gz
gitea-833f8b94c2cd88277eba32984594aad2b7b2b05d.zip
Search bar for issues/pulls (#530)
Diffstat (limited to 'routers/api/v1/repo/issue.go')
-rw-r--r--routers/api/v1/repo/issue.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/routers/api/v1/repo/issue.go b/routers/api/v1/repo/issue.go
index 908b5aeb96..ac0289c412 100644
--- a/routers/api/v1/repo/issue.go
+++ b/routers/api/v1/repo/issue.go
@@ -13,14 +13,16 @@ import (
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/setting"
+ "code.gitea.io/gitea/modules/util"
)
// ListIssues list the issues of a repository
func ListIssues(ctx *context.APIContext) {
+ isClosed := ctx.Query("state") == "closed"
issueOpts := models.IssuesOptions{
RepoID: ctx.Repo.Repository.ID,
Page: ctx.QueryInt("page"),
- IsClosed: ctx.Query("state") == "closed",
+ IsClosed: util.OptionalBoolOf(isClosed),
}
issues, err := models.Issues(&issueOpts)
@@ -29,7 +31,7 @@ func ListIssues(ctx *context.APIContext) {
return
}
if ctx.Query("state") == "all" {
- issueOpts.IsClosed = !issueOpts.IsClosed
+ issueOpts.IsClosed = util.OptionalBoolOf(!isClosed)
tempIssues, err := models.Issues(&issueOpts)
if err != nil {
ctx.Error(500, "Issues", err)