Browse Source

Fix overdue marking of closed issues and milestones (#14923)

Closed milestones and issues should only be marked overdue if they were
closed after their deadline.

Fix: #14536

Signed-off-by: Andrew Thornton <art27@cantab.net>
mj-v1.14.3
zeripath 1 year ago
committed by GitHub
parent
commit
78b7529cd4
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      models/issue.go
  2. 6
      models/issue_milestone.go

3
models/issue.go

@ -97,6 +97,9 @@ func (issue *Issue) loadTotalTimes(e Engine) (err error) {
// IsOverdue checks if the issue is overdue
func (issue *Issue) IsOverdue() bool {
if issue.IsClosed {
return issue.ClosedUnix >= issue.DeadlineUnix
}
return timeutil.TimeStampNow() >= issue.DeadlineUnix
}

6
models/issue_milestone.go

@ -63,8 +63,10 @@ func (m *Milestone) AfterLoad() {
}
m.DeadlineString = m.DeadlineUnix.Format("2006-01-02")
if timeutil.TimeStampNow() >= m.DeadlineUnix {
m.IsOverdue = true
if m.IsClosed {
m.IsOverdue = m.ClosedDateUnix >= m.DeadlineUnix
} else {
m.IsOverdue = timeutil.TimeStampNow() >= m.DeadlineUnix
}
}

Loading…
Cancel
Save