Fix deadline on update issue or PR via API (#8699)
This commit is contained in:
parent
76bbcf1387
commit
b2c3a7d79f
2 changed files with 12 additions and 14 deletions
|
@ -310,15 +310,14 @@ func EditIssue(ctx *context.APIContext, form api.EditIssueOption) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the deadline
|
// Update the deadline
|
||||||
var deadlineUnix util.TimeStamp
|
|
||||||
if form.Deadline != nil && !form.Deadline.IsZero() && ctx.Repo.CanWrite(models.UnitTypeIssues) {
|
if form.Deadline != nil && !form.Deadline.IsZero() && ctx.Repo.CanWrite(models.UnitTypeIssues) {
|
||||||
deadlineUnix = util.TimeStamp(form.Deadline.Unix())
|
deadlineUnix := util.TimeStamp(form.Deadline.Unix())
|
||||||
}
|
|
||||||
|
|
||||||
if err := models.UpdateIssueDeadline(issue, deadlineUnix, ctx.User); err != nil {
|
if err := models.UpdateIssueDeadline(issue, deadlineUnix, ctx.User); err != nil {
|
||||||
ctx.Error(500, "UpdateIssueDeadline", err)
|
ctx.Error(500, "UpdateIssueDeadline", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
issue.DeadlineUnix = deadlineUnix
|
||||||
|
}
|
||||||
|
|
||||||
// Add/delete assignees
|
// Add/delete assignees
|
||||||
|
|
||||||
|
|
|
@ -375,15 +375,14 @@ func EditPullRequest(ctx *context.APIContext, form api.EditPullRequestOption) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update Deadline
|
// Update Deadline
|
||||||
var deadlineUnix util.TimeStamp
|
|
||||||
if form.Deadline != nil && !form.Deadline.IsZero() {
|
if form.Deadline != nil && !form.Deadline.IsZero() {
|
||||||
deadlineUnix = util.TimeStamp(form.Deadline.Unix())
|
deadlineUnix := util.TimeStamp(form.Deadline.Unix())
|
||||||
}
|
|
||||||
|
|
||||||
if err := models.UpdateIssueDeadline(issue, deadlineUnix, ctx.User); err != nil {
|
if err := models.UpdateIssueDeadline(issue, deadlineUnix, ctx.User); err != nil {
|
||||||
ctx.Error(500, "UpdateIssueDeadline", err)
|
ctx.Error(500, "UpdateIssueDeadline", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
issue.DeadlineUnix = deadlineUnix
|
||||||
|
}
|
||||||
|
|
||||||
// Add/delete assignees
|
// Add/delete assignees
|
||||||
|
|
||||||
|
|
Reference in a new issue