diff options
author | zeripath <art27@cantab.net> | 2021-03-08 01:55:57 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-08 02:55:57 +0100 |
commit | 78b7529cd471eafefd555fe82b8dbb8b63dcd9f5 (patch) | |
tree | 51dca1a79b4dcb71c7895cc7ede7ca10e13ab307 /models | |
parent | 09fe0abb32d9b171f1e4b7d75928dfe77735585b (diff) | |
download | gitea-78b7529cd471eafefd555fe82b8dbb8b63dcd9f5.tar.gz gitea-78b7529cd471eafefd555fe82b8dbb8b63dcd9f5.zip |
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>
Diffstat (limited to 'models')
-rw-r--r-- | models/issue.go | 3 | ||||
-rw-r--r-- | models/issue_milestone.go | 6 |
2 files changed, 7 insertions, 2 deletions
diff --git a/models/issue.go b/models/issue.go index 7ca8391029..1b634ed9e8 100644 --- a/models/issue.go +++ b/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 } diff --git a/models/issue_milestone.go b/models/issue_milestone.go index 5c34834e2a..d3d9f7702f 100644 --- a/models/issue_milestone.go +++ b/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 } } |