diff options
author | KN4CK3R <admin@oldschoolhack.me> | 2021-08-09 20:08:51 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-09 14:08:51 -0400 |
commit | d9ef43a7126ab83af563c1c9b54cdf0092327b2a (patch) | |
tree | fabc9a9d24d42bb0de6dd9557c9e07e95bd5722b /templates/repo | |
parent | 23d438f56524a7c3fc185df66d6d95f797a80eee (diff) | |
download | gitea-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/repo')
-rw-r--r-- | templates/repo/commits_list.tmpl | 7 | ||||
-rw-r--r-- | templates/repo/commits_list_small.tmpl | 7 | ||||
-rw-r--r-- | templates/repo/issue/view_content/comments.tmpl | 2 |
3 files changed, 5 insertions, 11 deletions
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> |