mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-09 03:11:51 +01:00
Fix panic: template: repo/issue/list:210: unexpected "=" in operand (#6041)
This commit is contained in:
parent
7f38e2d0de
commit
23414ac2a1
2 changed files with 21 additions and 17 deletions
|
@ -953,6 +953,25 @@ func (issue *Issue) GetTasksDone() int {
|
||||||
return len(issueTasksDonePat.FindAllStringIndex(issue.Content, -1))
|
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.
|
// NewIssueOptions represents the options of a new issue.
|
||||||
type NewIssueOptions struct {
|
type NewIssueOptions struct {
|
||||||
Repo *Repository
|
Repo *Repository
|
||||||
|
|
|
@ -181,7 +181,6 @@
|
||||||
|
|
||||||
<div class="issue list">
|
<div class="issue list">
|
||||||
{{range .Issues}}
|
{{range .Issues}}
|
||||||
{{ $timeStr:= TimeSinceUnix .CreatedUnix $.Lang }}
|
|
||||||
<li class="item">
|
<li class="item">
|
||||||
<div class="ui checkbox issue-checkbox">
|
<div class="ui checkbox issue-checkbox">
|
||||||
<input type="checkbox" data-issue-id={{.ID}}></input>
|
<input type="checkbox" data-issue-id={{.ID}}></input>
|
||||||
|
@ -205,22 +204,8 @@
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
<p class="desc">
|
<p class="desc">
|
||||||
{{ $textToTranslate := "repo.issues.opened_by" }}
|
{{ $timeStr := TimeSinceUnix .GetLastEventTimestamp $.Lang }}
|
||||||
{{ if not .IsClosed }}
|
{{$.i18n.Tr .GetLastEventLabel $timeStr .Poster.HomeLink .Poster.Name | Safe}}
|
||||||
{{ $timeStr = TimeSinceUnix .CreatedUnix $.Lang }}
|
|
||||||
{{ else if and .IsClosed .IsPull }}
|
|
||||||
{{ $timeStr = TimeSinceUnix .ClosedUnix $.Lang }}
|
|
||||||
{{ if .PullRequest.HasMerged }}
|
|
||||||
{{ $textToTranslate = "repo.pulls.merged_by"}}
|
|
||||||
{{ else }}
|
|
||||||
{{ $textToTranslate = "repo.issues.closed_by"}}
|
|
||||||
{{ end }}
|
|
||||||
{{ else }}
|
|
||||||
{{ $timeStr = TimeSinceUnix .ClosedUnix $.Lang }}
|
|
||||||
{{ $textToTranslate = "repo.issues.closed_by"}}
|
|
||||||
{{ end }}
|
|
||||||
|
|
||||||
{{$.i18n.Tr $textToTranslate $timeStr .Poster.HomeLink .Poster.Name | Safe}}
|
|
||||||
|
|
||||||
{{$tasks := .GetTasks}}
|
{{$tasks := .GetTasks}}
|
||||||
{{if gt $tasks 0}}
|
{{if gt $tasks 0}}
|
||||||
|
|
Loading…
Reference in a new issue