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 {
953
953
return len (issueTasksDonePat .FindAllStringIndex (issue .Content , - 1 ))
954
954
}
955
955
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
+
956
975
// NewIssueOptions represents the options of a new issue.
957
976
type NewIssueOptions struct {
958
977
Repo * Repository
Original file line number Diff line number Diff line change 181
181
182
182
<div class="issue list">
183
183
{{range .Issues}}
184
- {{ $timeStr:= TimeSinceUnix .CreatedUnix $.Lang }}
185
184
<li class="item">
186
185
<div class="ui checkbox issue-checkbox">
187
186
<input type="checkbox" data-issue-id={{.ID}}></input>
205
204
{{end}}
206
205
207
206
<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}}
224
209
225
210
{{$tasks := .GetTasks}}
226
211
{{if gt $tasks 0}}
You can’t perform that action at this time.
0 commit comments