aboutsummaryrefslogtreecommitdiffstats
path: root/templates/repo/graph/commits.tmpl
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2023-04-23 02:16:22 +0800
committerGitHub <noreply@github.com>2023-04-22 14:16:22 -0400
commit88201914767e15a51c910d295647d97973fa09bf (patch)
tree460ac508dc67089db99877d5394db98844283f27 /templates/repo/graph/commits.tmpl
parentc0d105609f120839c91679b0548b9438155c4bba (diff)
downloadgitea-88201914767e15a51c910d295647d97973fa09bf.tar.gz
gitea-88201914767e15a51c910d295647d97973fa09bf.zip
Improve template helper functions: string/slice (#24266)
Follow #23328 The improvements: 1. The `contains` functions are covered by tests 2. The inconsistent behavior of `containGeneric` is replaced by `StringUtils.Contains` and `SliceUtils.Contains` 3. In the future we can move more help functions into XxxUtils to simplify the `helper.go` and reduce unnecessary global functions. FAQ: 1. Why it's called `StringUtils.Contains` but not `strings.Contains` like Golang? Because our `StringUtils` is not Golang's `strings` package. There will be our own string functions. --------- Co-authored-by: silverwind <me@silverwind.io>
Diffstat (limited to 'templates/repo/graph/commits.tmpl')
-rw-r--r--templates/repo/graph/commits.tmpl2
1 files changed, 1 insertions, 1 deletions
diff --git a/templates/repo/graph/commits.tmpl b/templates/repo/graph/commits.tmpl
index 4a01fefedd..44f63a7d76 100644
--- a/templates/repo/graph/commits.tmpl
+++ b/templates/repo/graph/commits.tmpl
@@ -35,7 +35,7 @@
{{range $commit.Refs}}
{{$refGroup := .RefGroup}}
{{if eq $refGroup "pull"}}
- {{if or (not $.HidePRRefs) (containGeneric $.SelectedBranches .Name)}}
+ {{if or (not $.HidePRRefs) (SliceUtils.Contains $.SelectedBranches .Name)}}
<!-- it's intended to use issues not pulls, if it's a pull you will get redirected -->
<a class="ui labelled icon button basic tiny gt-mr-2" href="{{$.RepoLink}}/{{if $.Repository.UnitEnabled $.Context $.UnitTypePullRequests}}pulls{{else}}issues{{end}}/{{.ShortName|PathEscape}}">
{{svg "octicon-git-pull-request" 16 "gt-mr-2"}}#{{.ShortName}}