diff options
Diffstat (limited to 'routers/api')
-rw-r--r-- | routers/api/v1/repo/issue.go | 10 | ||||
-rw-r--r-- | routers/api/v1/repo/pull.go | 4 |
2 files changed, 9 insertions, 5 deletions
diff --git a/routers/api/v1/repo/issue.go b/routers/api/v1/repo/issue.go index 4396e6faae..ad82d53e7a 100644 --- a/routers/api/v1/repo/issue.go +++ b/routers/api/v1/repo/issue.go @@ -524,8 +524,8 @@ func EditIssue(ctx *context.APIContext, form api.EditIssueOption) { } } - if err = models.UpdateIssue(issue); err != nil { - ctx.Error(http.StatusInternalServerError, "UpdateIssue", err) + if err = models.UpdateIssueByAPI(issue); err != nil { + ctx.Error(http.StatusInternalServerError, "UpdateIssueByAPI", err) return } if form.State != nil { @@ -542,7 +542,11 @@ func EditIssue(ctx *context.APIContext, form api.EditIssueOption) { // Refetch from database to assign some automatic values issue, err = models.GetIssueByID(issue.ID) if err != nil { - ctx.Error(http.StatusInternalServerError, "GetIssueByID", err) + ctx.InternalServerError(err) + return + } + if err = issue.LoadMilestone(); err != nil { + ctx.InternalServerError(err) return } ctx.JSON(http.StatusCreated, issue.APIFormat()) diff --git a/routers/api/v1/repo/pull.go b/routers/api/v1/repo/pull.go index 0392eb8e8c..d0551320fd 100644 --- a/routers/api/v1/repo/pull.go +++ b/routers/api/v1/repo/pull.go @@ -450,8 +450,8 @@ func EditPullRequest(ctx *context.APIContext, form api.EditPullRequestOption) { } } - if err = models.UpdateIssue(issue); err != nil { - ctx.Error(http.StatusInternalServerError, "UpdateIssue", err) + if err = models.UpdateIssueByAPI(issue); err != nil { + ctx.Error(http.StatusInternalServerError, "UpdateIssueByAPI", err) return } if form.State != nil { |