mirror of
https://github.com/go-gitea/gitea.git
synced 2024-12-04 14:46:57 -05:00
Check if the due_date
is nil when editing issues (#32035)
This commit is contained in:
parent
f05d9c98c4
commit
3a51c37672
@ -833,10 +833,16 @@ func EditIssue(ctx *context.APIContext) {
|
|||||||
if (form.Deadline != nil || form.RemoveDeadline != nil) && canWrite {
|
if (form.Deadline != nil || form.RemoveDeadline != nil) && canWrite {
|
||||||
var deadlineUnix timeutil.TimeStamp
|
var deadlineUnix timeutil.TimeStamp
|
||||||
|
|
||||||
if (form.RemoveDeadline == nil || !*form.RemoveDeadline) && !form.Deadline.IsZero() {
|
if form.RemoveDeadline == nil || !*form.RemoveDeadline {
|
||||||
deadline := time.Date(form.Deadline.Year(), form.Deadline.Month(), form.Deadline.Day(),
|
if form.Deadline == nil {
|
||||||
23, 59, 59, 0, form.Deadline.Location())
|
ctx.Error(http.StatusBadRequest, "", "The due_date cannot be empty")
|
||||||
deadlineUnix = timeutil.TimeStamp(deadline.Unix())
|
return
|
||||||
|
}
|
||||||
|
if !form.Deadline.IsZero() {
|
||||||
|
deadline := time.Date(form.Deadline.Year(), form.Deadline.Month(), form.Deadline.Day(),
|
||||||
|
23, 59, 59, 0, form.Deadline.Location())
|
||||||
|
deadlineUnix = timeutil.TimeStamp(deadline.Unix())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := issues_model.UpdateIssueDeadline(ctx, issue, deadlineUnix, ctx.Doer); err != nil {
|
if err := issues_model.UpdateIssueDeadline(ctx, issue, deadlineUnix, ctx.Doer); err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user