Fix deadline on update issue or PR via API (#8699)

pull/8731/head
David Svantesson 5 years ago committed by Lauris BH
parent 76bbcf1387
commit b2c3a7d79f
  1. 13
      routers/api/v1/repo/issue.go
  2. 13
      routers/api/v1/repo/pull.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

@ -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

Loading…
Cancel
Save