diff --git a/routers/api/v1/repo/issue.go b/routers/api/v1/repo/issue.go index daaa3d59856..af320a39ebf 100644 --- a/routers/api/v1/repo/issue.go +++ b/routers/api/v1/repo/issue.go @@ -310,14 +310,13 @@ func EditIssue(ctx *context.APIContext, form api.EditIssueOption) { } // Update the deadline - var deadlineUnix util.TimeStamp if form.Deadline != nil && !form.Deadline.IsZero() && ctx.Repo.CanWrite(models.UnitTypeIssues) { - deadlineUnix = util.TimeStamp(form.Deadline.Unix()) - } - - if err := models.UpdateIssueDeadline(issue, deadlineUnix, ctx.User); err != nil { - ctx.Error(500, "UpdateIssueDeadline", err) - return + deadlineUnix := util.TimeStamp(form.Deadline.Unix()) + if err := models.UpdateIssueDeadline(issue, deadlineUnix, ctx.User); err != nil { + ctx.Error(500, "UpdateIssueDeadline", err) + return + } + issue.DeadlineUnix = deadlineUnix } // Add/delete assignees diff --git a/routers/api/v1/repo/pull.go b/routers/api/v1/repo/pull.go index d99c9a00c99..4ad3479fd09 100644 --- a/routers/api/v1/repo/pull.go +++ b/routers/api/v1/repo/pull.go @@ -375,14 +375,13 @@ func EditPullRequest(ctx *context.APIContext, form api.EditPullRequestOption) { } // Update Deadline - var deadlineUnix util.TimeStamp if form.Deadline != nil && !form.Deadline.IsZero() { - deadlineUnix = util.TimeStamp(form.Deadline.Unix()) - } - - if err := models.UpdateIssueDeadline(issue, deadlineUnix, ctx.User); err != nil { - ctx.Error(500, "UpdateIssueDeadline", err) - return + deadlineUnix := util.TimeStamp(form.Deadline.Unix()) + if err := models.UpdateIssueDeadline(issue, deadlineUnix, ctx.User); err != nil { + ctx.Error(500, "UpdateIssueDeadline", err) + return + } + issue.DeadlineUnix = deadlineUnix } // Add/delete assignees