From 25faee3c5f5be23c99b3b7e50418fc0dbad7a41b Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Tue, 11 Apr 2023 17:48:13 +0800 Subject: [PATCH] Fix date display bug (#24047) Follow https://github.com/go-gitea/gitea/pull/23988#pullrequestreview-1377696819 Many template helper functions are not good enough and cause various problems, that's why I am cleaning them. ## Before ![image](https://user-images.githubusercontent.com/51889757/230930898-0c48150f-de85-461d-9455-efcfdc36b644.png) ![image](https://user-images.githubusercontent.com/2114189/231111676-b0da1392-5e47-4f89-a81e-85156aca5cfd.png) ## After ![image](https://user-images.githubusercontent.com/2114189/231111732-920f304d-dd44-4c54-9f5f-518e325006fc.png) --- templates/projects/list.tmpl | 2 +- templates/repo/issue/milestone_issues.tmpl | 2 +- templates/repo/issue/milestones.tmpl | 2 +- templates/repo/issue/view_content/comments.tmpl | 4 ++-- templates/repo/projects/list.tmpl | 2 +- templates/user/dashboard/milestones.tmpl | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/templates/projects/list.tmpl b/templates/projects/list.tmpl index 73ae5ab6e407..213bab70b66e 100644 --- a/templates/projects/list.tmpl +++ b/templates/projects/list.tmpl @@ -42,7 +42,7 @@
{{$closedDate:= TimeSinceUnix .ClosedDateUnix $.locale}} {{if .IsClosed}} - {{svg "octicon-clock"}} {{$.locale.Tr "repo.milestones.closed" $closedDate|Str2html}} + {{svg "octicon-clock"}} {{$.locale.Tr "repo.milestones.closed" $closedDate | Safe}} {{end}} {{svg "octicon-issue-opened" 16 "gt-mr-3"}} diff --git a/templates/repo/issue/milestone_issues.tmpl b/templates/repo/issue/milestone_issues.tmpl index 123845de68fa..c3c25843e8e1 100644 --- a/templates/repo/issue/milestone_issues.tmpl +++ b/templates/repo/issue/milestone_issues.tmpl @@ -31,7 +31,7 @@
{{$closedDate:= TimeSinceUnix .Milestone.ClosedDateUnix $.locale}} {{if .IsClosed}} - {{svg "octicon-clock"}} {{$.locale.Tr "repo.milestones.closed" $closedDate|Str2html}} + {{svg "octicon-clock"}} {{$.locale.Tr "repo.milestones.closed" $closedDate | Safe}} {{else}} {{svg "octicon-calendar"}} {{if .Milestone.DeadlineString}} diff --git a/templates/repo/issue/milestones.tmpl b/templates/repo/issue/milestones.tmpl index 0336d35c1787..42a6c4f91955 100644 --- a/templates/repo/issue/milestones.tmpl +++ b/templates/repo/issue/milestones.tmpl @@ -73,7 +73,7 @@
{{$closedDate:= TimeSinceUnix .ClosedDateUnix $.locale}} {{if .IsClosed}} - {{svg "octicon-clock"}} {{$.locale.Tr "repo.milestones.closed" $closedDate|Str2html}} + {{svg "octicon-clock"}} {{$.locale.Tr "repo.milestones.closed" $closedDate | Safe}} {{else}} {{svg "octicon-calendar"}} {{if .DeadlineString}} diff --git a/templates/repo/issue/view_content/comments.tmpl b/templates/repo/issue/view_content/comments.tmpl index 91bef4fe1ac7..251f205a0312 100644 --- a/templates/repo/issue/view_content/comments.tmpl +++ b/templates/repo/issue/view_content/comments.tmpl @@ -125,9 +125,9 @@ {{template "shared/user/authorlink" .Poster}} {{$link := printf "%s/commit/%s" $.Repository.Link ($.Issue.PullRequest.MergedCommitID|PathEscape)}} {{if eq $.Issue.PullRequest.Status 3}} - {{$.locale.Tr "repo.issues.manually_pull_merged_at" ($link|Escape) (ShortSha $.Issue.PullRequest.MergedCommitID) ($.BaseTarget|Escape) $createdStr | Str2html}} + {{$.locale.Tr "repo.issues.manually_pull_merged_at" ($link|Escape) (ShortSha $.Issue.PullRequest.MergedCommitID) ($.BaseTarget|Escape) $createdStr | Safe}} {{else}} - {{$.locale.Tr "repo.issues.pull_merged_at" ($link|Escape) (ShortSha $.Issue.PullRequest.MergedCommitID) ($.BaseTarget|Escape) $createdStr | Str2html}} + {{$.locale.Tr "repo.issues.pull_merged_at" ($link|Escape) (ShortSha $.Issue.PullRequest.MergedCommitID) ($.BaseTarget|Escape) $createdStr | Safe}} {{end}}
diff --git a/templates/repo/projects/list.tmpl b/templates/repo/projects/list.tmpl index 227a2727055c..fb5bc4f48d91 100644 --- a/templates/repo/projects/list.tmpl +++ b/templates/repo/projects/list.tmpl @@ -44,7 +44,7 @@
{{$closedDate:= TimeSinceUnix .ClosedDateUnix $.locale}} {{if .IsClosed}} - {{svg "octicon-clock"}} {{$.locale.Tr "repo.milestones.closed" $closedDate|Str2html}} + {{svg "octicon-clock"}} {{$.locale.Tr "repo.milestones.closed" $closedDate | Safe}} {{end}} {{svg "octicon-issue-opened" 16 "gt-mr-3"}} diff --git a/templates/user/dashboard/milestones.tmpl b/templates/user/dashboard/milestones.tmpl index 1c379ac09d02..6788aa09a2ac 100644 --- a/templates/user/dashboard/milestones.tmpl +++ b/templates/user/dashboard/milestones.tmpl @@ -93,7 +93,7 @@
{{$closedDate:= TimeSinceUnix .ClosedDateUnix $.locale}} {{if .IsClosed}} - {{svg "octicon-clock"}} {{$.locale.Tr "repo.milestones.closed" $closedDate|Str2html}} + {{svg "octicon-clock"}} {{$.locale.Tr "repo.milestones.closed" $closedDate | Safe}} {{else}} {{svg "octicon-calendar"}} {{if .DeadlineString}}