Skip to content

Commit f7cf817

Browse files
committed
fix trimSpace in pushedCommits template
1 parent 61b0a38 commit f7cf817

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

server/plugin/template.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ func init() {
4747
return body
4848
}
4949

50+
// Trim space
51+
funcMap["trimSpace"] = func(body string) string {
52+
return strings.TrimSpace(body)
53+
}
54+
5055
// Trim a ref to use in constructing a link.
5156
funcMap["trimRef"] = func(ref string) string {
5257
return strings.Replace(ref, "refs/heads/", "", 1)
@@ -319,7 +324,7 @@ Assignees: {{range $i, $el := .Assignees -}} {{- if $i}}, {{end}}{{template "FUs
319324
template.Must(masterTemplate.New("pushedCommits").Funcs(funcMap).Parse(`
320325
{{template "user" .GetSender}} {{if .GetForced}}force-{{end}}pushed [{{len .Commits}} new commit{{if ne (len .Commits) 1}}s{{end}}]({{.GetCompare}}) to [\[{{.GetRepo.GetFullName}}:{{.GetRef | trimRef}}\]]({{.GetRepo.GetHTMLURL}}/tree/{{.GetRef | trimRef}}):
321326
{{range .Commits -}}
322-
[` + "`{{.GetID | substr 0 6}}`" + `]({{.GetURL}}) {{.GetMessage}} - {{with . | commitAuthor}}{{.GetName}}{{end}}
327+
[` + "`{{.GetID | substr 0 6}}`" + `]({{.GetURL}}) {{.GetMessage | trimSpace}} - {{with . | commitAuthor}}{{.GetName}}{{end}}
323328
{{end -}}
324329
`))
325330

0 commit comments

Comments
 (0)