mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-21 14:51:00 +01:00
Fix deadline on update issue or PR via API (#8696)
* Fix deadline on update issue or PR via API * variable initialized directly (review comment)
This commit is contained in:
parent
478f7db68e
commit
018b0e8180
2 changed files with 14 additions and 16 deletions
|
@ -336,14 +336,13 @@ func EditIssue(ctx *context.APIContext, form api.EditIssueOption) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the deadline
|
// Update the deadline
|
||||||
var deadlineUnix timeutil.TimeStamp
|
if form.Deadline != nil && ctx.Repo.CanWrite(models.UnitTypeIssues) {
|
||||||
if form.Deadline != nil && !form.Deadline.IsZero() && ctx.Repo.CanWrite(models.UnitTypeIssues) {
|
deadlineUnix := timeutil.TimeStamp(form.Deadline.Unix())
|
||||||
deadlineUnix = timeutil.TimeStamp(form.Deadline.Unix())
|
if err := models.UpdateIssueDeadline(issue, deadlineUnix, ctx.User); err != nil {
|
||||||
}
|
ctx.Error(500, "UpdateIssueDeadline", err)
|
||||||
|
return
|
||||||
if err := models.UpdateIssueDeadline(issue, deadlineUnix, ctx.User); err != nil {
|
}
|
||||||
ctx.Error(500, "UpdateIssueDeadline", err)
|
issue.DeadlineUnix = deadlineUnix
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add/delete assignees
|
// Add/delete assignees
|
||||||
|
|
|
@ -392,14 +392,13 @@ func EditPullRequest(ctx *context.APIContext, form api.EditPullRequestOption) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update Deadline
|
// Update Deadline
|
||||||
var deadlineUnix timeutil.TimeStamp
|
if form.Deadline != nil {
|
||||||
if form.Deadline != nil && !form.Deadline.IsZero() {
|
deadlineUnix := timeutil.TimeStamp(form.Deadline.Unix())
|
||||||
deadlineUnix = timeutil.TimeStamp(form.Deadline.Unix())
|
if err := models.UpdateIssueDeadline(issue, deadlineUnix, ctx.User); err != nil {
|
||||||
}
|
ctx.Error(500, "UpdateIssueDeadline", err)
|
||||||
|
return
|
||||||
if err := models.UpdateIssueDeadline(issue, deadlineUnix, ctx.User); err != nil {
|
}
|
||||||
ctx.Error(500, "UpdateIssueDeadline", err)
|
issue.DeadlineUnix = deadlineUnix
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add/delete assignees
|
// Add/delete assignees
|
||||||
|
|
Loading…
Reference in a new issue