From 23414ac2a1d83f91ff47c5d8bbedebe709b1f408 Mon Sep 17 00:00:00 2001 From: Zsombor Date: Wed, 13 Feb 2019 09:14:17 +0100 Subject: Fix panic: template: repo/issue/list:210: unexpected "=" in operand (#6041) --- models/issue.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'models/issue.go') diff --git a/models/issue.go b/models/issue.go index 850346674b..1421b28da2 100644 --- a/models/issue.go +++ b/models/issue.go @@ -953,6 +953,25 @@ func (issue *Issue) GetTasksDone() int { return len(issueTasksDonePat.FindAllStringIndex(issue.Content, -1)) } +// GetLastEventTimestamp returns the last user visible event timestamp, either the creation of this issue or the close. +func (issue *Issue) GetLastEventTimestamp() util.TimeStamp { + if issue.IsClosed { + return issue.ClosedUnix + } + return issue.CreatedUnix +} + +// GetLastEventLabel returns the localization label for the current issue. +func (issue *Issue) GetLastEventLabel() string { + if issue.IsClosed { + if issue.IsPull && issue.PullRequest.HasMerged { + return "repo.pulls.merged_by" + } + return "repo.issues.closed_by" + } + return "repo.issues.opened_by" +} + // NewIssueOptions represents the options of a new issue. type NewIssueOptions struct { Repo *Repository -- cgit v1.2.3