From d9ef43a7126ab83af563c1c9b54cdf0092327b2a Mon Sep 17 00:00:00 2001 From: KN4CK3R Date: Mon, 9 Aug 2021 20:08:51 +0200 Subject: Replace `list.List` with slices (#16311) * Replaced list with slice. * Fixed usage of pointer to temporary variable. * Replaced LIFO list with slice. * Lint * Removed type check. * Removed duplicated code. * Lint * Fixed merge. Co-authored-by: 6543 <6543@obermui.de> --- templates/repo/commits_list.tmpl | 7 ++----- templates/repo/commits_list_small.tmpl | 7 ++----- templates/repo/issue/view_content/comments.tmpl | 2 +- 3 files changed, 5 insertions(+), 11 deletions(-) (limited to 'templates/repo') diff --git a/templates/repo/commits_list.tmpl b/templates/repo/commits_list.tmpl index 66138e2138..5282430ec7 100644 --- a/templates/repo/commits_list.tmpl +++ b/templates/repo/commits_list.tmpl @@ -9,8 +9,7 @@ - {{ $r:= List .Commits}} - {{range $r}} + {{range .Commits}} {{$userName := .Author.Name}} @@ -69,9 +68,7 @@ {{if IsMultilineCommitMessage .Message}} {{end}} - {{if eq (CommitType .) "SignCommitWithStatuses"}} - {{template "repo/commit_statuses" dict "Status" .Status "Statuses" .Statuses "root" $}} - {{end}} + {{template "repo/commit_statuses" dict "Status" .Status "Statuses" .Statuses "root" $}} {{if IsMultilineCommitMessage .Message}} {{end}} diff --git a/templates/repo/commits_list_small.tmpl b/templates/repo/commits_list_small.tmpl index acab040a45..bdbee816cc 100644 --- a/templates/repo/commits_list_small.tmpl +++ b/templates/repo/commits_list_small.tmpl @@ -1,7 +1,6 @@ -{{ $r:= List .comment.Commits}} {{ $index := 0}}
-{{range $r}} +{{range .comment.Commits}} {{ $tag := printf "%s-%d" $.comment.HashTag $index }} {{ $index = Add $index 1}}
@@ -15,9 +14,7 @@ {{end}} - {{if eq (CommitType .) "SignCommitWithStatuses"}} - {{template "repo/commit_statuses" dict "Status" .Status "Statuses" .Statuses "root" $.root}} - {{end}} + {{template "repo/commit_statuses" dict "Status" .Status "Statuses" .Statuses "root" $.root}} {{$class := "ui sha label"}} {{if .Signature}} {{$class = (printf "%s%s" $class " isSigned")}} diff --git a/templates/repo/issue/view_content/comments.tmpl b/templates/repo/issue/view_content/comments.tmpl index dcc0401c99..7bc90b0434 100644 --- a/templates/repo/issue/view_content/comments.tmpl +++ b/templates/repo/issue/view_content/comments.tmpl @@ -699,7 +699,7 @@ {{ if .IsForcePush }} {{$.i18n.Tr "repo.issues.force_push_codes" $.Issue.PullRequest.HeadBranch (ShortSha .OldCommit) ($.Issue.Repo.CommitLink .OldCommit) (ShortSha .NewCommit) ($.Issue.Repo.CommitLink .NewCommit) $createdStr | Safe}} {{else}} - {{$.i18n.Tr (TrN $.i18n.Lang .Commits.Len "repo.issues.push_commit_1" "repo.issues.push_commits_n") .Commits.Len $createdStr | Safe}} + {{$.i18n.Tr (TrN $.i18n.Lang (len .Commits) "repo.issues.push_commit_1" "repo.issues.push_commits_n") (len .Commits) $createdStr | Safe}} {{end}}
-- cgit v1.2.3