]> source.dussan.org Git - gitea.git/commitdiff
Fix deadline on update issue or PR via API (#8699)
authorDavid Svantesson <davidsvantesson@gmail.com>
Sun, 27 Oct 2019 23:36:28 +0000 (00:36 +0100)
committerLauris BH <lauris@nix.lv>
Sun, 27 Oct 2019 23:36:28 +0000 (01:36 +0200)
routers/api/v1/repo/issue.go
routers/api/v1/repo/pull.go

index daaa3d59856aa65a35a8789b4492ab4face81e60..af320a39ebf35d2a4b86ab0efc69fab472c4d5de 100644 (file)
@@ -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
index d99c9a00c99ae1ce1365658faae32b7598deab2a..4ad3479fd0901cb2b60d6965fce9bc66f42c1912 100644 (file)
@@ -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