summaryrefslogtreecommitdiffstats
path: root/templates
diff options
context:
space:
mode:
authorKN4CK3R <admin@oldschoolhack.me>2021-08-09 20:08:51 +0200
committerGitHub <noreply@github.com>2021-08-09 14:08:51 -0400
commitd9ef43a7126ab83af563c1c9b54cdf0092327b2a (patch)
treefabc9a9d24d42bb0de6dd9557c9e07e95bd5722b /templates
parent23d438f56524a7c3fc185df66d6d95f797a80eee (diff)
downloadgitea-d9ef43a7126ab83af563c1c9b54cdf0092327b2a.tar.gz
gitea-d9ef43a7126ab83af563c1c9b54cdf0092327b2a.zip
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>
Diffstat (limited to 'templates')
-rw-r--r--templates/mail/issue/default.tmpl5
-rw-r--r--templates/repo/commits_list.tmpl7
-rw-r--r--templates/repo/commits_list_small.tmpl7
-rw-r--r--templates/repo/issue/view_content/comments.tmpl2
-rw-r--r--templates/user/dashboard/feeds.tmpl20
5 files changed, 16 insertions, 25 deletions
diff --git a/templates/mail/issue/default.tmpl b/templates/mail/issue/default.tmpl
index 071acdcbcf..6c74f34c29 100644
--- a/templates/mail/issue/default.tmpl
+++ b/templates/mail/issue/default.tmpl
@@ -30,7 +30,7 @@
{{.i18n.Tr "mail.issue.action.force_push" .Doer.Name .Comment.Issue.PullRequest.HeadBranch $oldCommitLink $newCommitLink | Str2html}}
{{else}}
- {{.i18n.Tr (TrN .i18n.Lang .Comment.Commits.Len "mail.issue.action.push_1" "mail.issue.action.push_n") .Doer.Name .Comment.Issue.PullRequest.HeadBranch .Comment.Commits.Len | Str2html}}
+ {{.i18n.Tr (TrN .i18n.Lang (len .Comment.Commits) "mail.issue.action.push_1" "mail.issue.action.push_n") .Doer.Name .Comment.Issue.PullRequest.HeadBranch (len .Comment.Commits) | Str2html}}
{{end}}
</p>
{{end}}
@@ -69,9 +69,8 @@
</div>
{{end -}}
{{if eq .ActionName "push"}}
- {{ $r:= List .Comment.Commits}}
<ul>
- {{range $r}}
+ {{range .Comment.Commits}}
<li>
<a href="{{AppUrl}}{{$.Comment.Issue.PullRequest.BaseRepo.OwnerName}}/{{$.Comment.Issue.PullRequest.BaseRepo.Name}}/commit/{{.ID}}">
{{ShortSha .ID.String}}
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 @@
</tr>
</thead>
<tbody class="commit-list">
- {{ $r:= List .Commits}}
- {{range $r}}
+ {{range .Commits}}
<tr>
<td class="author">
{{$userName := .Author.Name}}
@@ -69,9 +68,7 @@
{{if IsMultilineCommitMessage .Message}}
<button class="basic compact mini ui icon button commit-button"><i class="ellipsis horizontal icon"></i></button>
{{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}}
<pre class="commit-body" style="display: none;">{{RenderCommitBody .Message $.RepoLink $.Repository.ComposeMetas}}</pre>
{{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}}
<div class="timeline-item commits-list">
-{{range $r}}
+{{range .comment.Commits}}
{{ $tag := printf "%s-%d" $.comment.HashTag $index }}
{{ $index = Add $index 1}}
<div class="singular-commit" id="{{$tag}}">
@@ -15,9 +14,7 @@
{{end}}
<span class="ui float right shabox">
- {{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}}
</span>
</div>
diff --git a/templates/user/dashboard/feeds.tmpl b/templates/user/dashboard/feeds.tmpl
index 745fb1ec63..1b770d4472 100644
--- a/templates/user/dashboard/feeds.tmpl
+++ b/templates/user/dashboard/feeds.tmpl
@@ -89,17 +89,15 @@
<ul>
{{ $push := ActionContent2Commits .}}
{{ $repoLink := .GetRepoLink}}
- {{if $push.Commits}}
- {{range $push.Commits}}
- {{ $commitLink := printf "%s/commit/%s" $repoLink .Sha1}}
- <li>
- {{avatarHTML ($push.AvatarLink .AuthorEmail) 16 "mr-2" .AuthorName}}
- <a class="commit-id mr-2" href="{{$commitLink}}">{{ShortSha .Sha1}}</a>
- <span class="text truncate light grey">
- {{RenderCommitMessage .Message $repoLink $.ComposeMetas}}
- </span>
- </li>
- {{end}}
+ {{range $push.Commits}}
+ {{ $commitLink := printf "%s/commit/%s" $repoLink .Sha1}}
+ <li>
+ {{avatarHTML ($push.AvatarLink .AuthorEmail) 16 "mr-2" .AuthorName}}
+ <a class="commit-id mr-2" href="{{$commitLink}}">{{ShortSha .Sha1}}</a>
+ <span class="text truncate light grey">
+ {{RenderCommitMessage .Message $repoLink $.ComposeMetas}}
+ </span>
+ </li>
{{end}}
{{if and (gt (len $push.Commits) 1) $push.CompareURL}}<li><a href="{{AppSubUrl}}/{{$push.CompareURL}}">{{$.i18n.Tr "action.compare_commits" (len $push.Commits)}} ยป</a></li>{{end}}
</ul>