diff options
author | David Svantesson <davidsvantesson@gmail.com> | 2019-10-28 00:36:59 +0100 |
---|---|---|
committer | Lauris BH <lauris@nix.lv> | 2019-10-28 01:36:59 +0200 |
commit | 8caf05989f23fa235a6ec4b46ba3a1b8c56f3495 (patch) | |
tree | f649f2e06add27a9bc30205a5de9b5758bcfdd35 /routers | |
parent | 9bde52ffc1bdfc6fcc3d2995776d60d8b42ce316 (diff) | |
download | gitea-8caf05989f23fa235a6ec4b46ba3a1b8c56f3495.tar.gz gitea-8caf05989f23fa235a6ec4b46ba3a1b8c56f3495.zip |
Fix deadline on update issue or PR via API (#8698)
Diffstat (limited to 'routers')
-rw-r--r-- | routers/api/v1/repo/issue.go | 15 | ||||
-rw-r--r-- | routers/api/v1/repo/pull.go | 15 |
2 files changed, 14 insertions, 16 deletions
diff --git a/routers/api/v1/repo/issue.go b/routers/api/v1/repo/issue.go index aab167bc68..6fec1c66b8 100644 --- a/routers/api/v1/repo/issue.go +++ b/routers/api/v1/repo/issue.go @@ -312,14 +312,13 @@ func EditIssue(ctx *context.APIContext, form api.EditIssueOption) { } // Update the deadline - var deadlineUnix timeutil.TimeStamp - if form.Deadline != nil && !form.Deadline.IsZero() && ctx.Repo.CanWrite(models.UnitTypeIssues) { - deadlineUnix = timeutil.TimeStamp(form.Deadline.Unix()) - } - - if err := models.UpdateIssueDeadline(issue, deadlineUnix, ctx.User); err != nil { - ctx.Error(500, "UpdateIssueDeadline", err) - return + if form.Deadline != nil && ctx.Repo.CanWrite(models.UnitTypeIssues) { + deadlineUnix := timeutil.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 16ddd10c60..4d6a84d8f8 100644 --- a/routers/api/v1/repo/pull.go +++ b/routers/api/v1/repo/pull.go @@ -368,14 +368,13 @@ func EditPullRequest(ctx *context.APIContext, form api.EditPullRequestOption) { } // Update Deadline - var deadlineUnix timeutil.TimeStamp - if form.Deadline != nil && !form.Deadline.IsZero() { - deadlineUnix = timeutil.TimeStamp(form.Deadline.Unix()) - } - - if err := models.UpdateIssueDeadline(issue, deadlineUnix, ctx.User); err != nil { - ctx.Error(500, "UpdateIssueDeadline", err) - return + if form.Deadline != nil { + deadlineUnix := timeutil.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 |