diff options
author | David Svantesson | 2019-10-28 00:36:28 +0100 |
---|---|---|
committer | Lauris BH | 2019-10-28 01:36:28 +0200 |
commit | b2c3a7d79f87fb443ff2b479ce9c280f99262dbe (patch) | |
tree | 0747c85174cab680e3d963ab22039ab07cbf1a2e | |
parent | 76bbcf13870a46b15d7fb04a311e8584d76c3a15 (diff) |
Fix deadline on update issue or PR via API (#8699)
-rw-r--r-- | routers/api/v1/repo/issue.go | 13 | ||||
-rw-r--r-- | routers/api/v1/repo/pull.go | 13 |
2 files changed, 12 insertions, 14 deletions
diff --git a/routers/api/v1/repo/issue.go b/routers/api/v1/repo/issue.go index daaa3d598..af320a39e 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 d99c9a00c..4ad3479fd 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 |