File tree Expand file tree Collapse file tree 2 files changed +21
-17
lines changed Expand file tree Collapse file tree 2 files changed +21
-17
lines changed Original file line number Diff line number Diff line change @@ -953,6 +953,25 @@ func (issue *Issue) GetTasksDone() int {
953953 return len (issueTasksDonePat .FindAllStringIndex (issue .Content , - 1 ))
954954}
955955
956+ // GetLastEventTimestamp returns the last user visible event timestamp, either the creation of this issue or the close.
957+ func (issue * Issue ) GetLastEventTimestamp () util.TimeStamp {
958+ if issue .IsClosed {
959+ return issue .ClosedUnix
960+ }
961+ return issue .CreatedUnix
962+ }
963+
964+ // GetLastEventLabel returns the localization label for the current issue.
965+ func (issue * Issue ) GetLastEventLabel () string {
966+ if issue .IsClosed {
967+ if issue .IsPull && issue .PullRequest .HasMerged {
968+ return "repo.pulls.merged_by"
969+ }
970+ return "repo.issues.closed_by"
971+ }
972+ return "repo.issues.opened_by"
973+ }
974+
956975// NewIssueOptions represents the options of a new issue.
957976type NewIssueOptions struct {
958977 Repo * Repository
Original file line number Diff line number Diff line change 181181
182182 <div class="issue list">
183183 {{range .Issues}}
184- {{ $timeStr:= TimeSinceUnix .CreatedUnix $.Lang }}
185184 <li class="item">
186185 <div class="ui checkbox issue-checkbox">
187186 <input type="checkbox" data-issue-id={{.ID}}></input>
205204 {{end}}
206205
207206 <p class="desc">
208- {{ $textToTranslate := "repo.issues.opened_by" }}
209- {{ if not .IsClosed }}
210- {{ $timeStr = TimeSinceUnix .CreatedUnix $.Lang }}
211- {{ else if and .IsClosed .IsPull }}
212- {{ $timeStr = TimeSinceUnix .ClosedUnix $.Lang }}
213- {{ if .PullRequest.HasMerged }}
214- {{ $textToTranslate = "repo.pulls.merged_by"}}
215- {{ else }}
216- {{ $textToTranslate = "repo.issues.closed_by"}}
217- {{ end }}
218- {{ else }}
219- {{ $timeStr = TimeSinceUnix .ClosedUnix $.Lang }}
220- {{ $textToTranslate = "repo.issues.closed_by"}}
221- {{ end }}
222-
223- {{$.i18n.Tr $textToTranslate $timeStr .Poster.HomeLink .Poster.Name | Safe}}
207+ {{ $timeStr := TimeSinceUnix .GetLastEventTimestamp $.Lang }}
208+ {{$.i18n.Tr .GetLastEventLabel $timeStr .Poster.HomeLink .Poster.Name | Safe}}
224209
225210 {{$tasks := .GetTasks}}
226211 {{if gt $tasks 0}}
You can’t perform that action at this time.
0 commit comments