aboutsummaryrefslogtreecommitdiffstats
path: root/routers/api
diff options
context:
space:
mode:
Diffstat (limited to 'routers/api')
-rw-r--r--routers/api/v1/repo/issue.go6
-rw-r--r--routers/api/v1/repo/issue_comment.go2
2 files changed, 5 insertions, 3 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)
diff --git a/routers/api/v1/repo/issue_comment.go b/routers/api/v1/repo/issue_comment.go
index 1afd3e9d78..13e3ec6ab8 100644
--- a/routers/api/v1/repo/issue_comment.go
+++ b/routers/api/v1/repo/issue_comment.go
@@ -125,7 +125,7 @@ func DeleteIssueComment(ctx *context.APIContext) {
return
}
- if err = models.DeleteCommentByID(comment.ID); err != nil {
+ if err = models.DeleteComment(comment); err != nil {
ctx.Error(500, "DeleteCommentByID", err)
return
}