Skip to content

Commit b44175c

Browse files
GiteaBotwxiaoguang
andauthored
Refactor commit message rendering and fix bugs (go-gitea#34412) (go-gitea#34414)
Backport go-gitea#34412 by wxiaoguang Fix go-gitea#34398, fix go-gitea#33308 Remove all `repo.ComposeCommentMetas` from templates, only use `repo` to render commit message. Co-authored-by: wxiaoguang <[email protected]>
1 parent 947358d commit b44175c

File tree

17 files changed

+102
-107
lines changed

17 files changed

+102
-107
lines changed

models/renderhelper/commit_checker.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func (c *commitChecker) IsCommitIDExisting(commitID string) bool {
4747
c.gitRepo, c.gitRepoCloser = r, closer
4848
}
4949

50-
exist = c.gitRepo.IsReferenceExist(commitID) // Don't use IsObjectExist since it doesn't support short hashs with gogit edition.
50+
exist = c.gitRepo.IsReferenceExist(commitID) // Don't use IsObjectExist since it doesn't support short hashes with gogit edition.
5151
c.commitCache[commitID] = exist
5252
return exist
5353
}

modules/templates/util_date_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717
func TestDateTime(t *testing.T) {
1818
testTz, _ := time.LoadLocation("America/New_York")
1919
defer test.MockVariableValue(&setting.DefaultUILocation, testTz)()
20+
defer test.MockVariableValue(&setting.IsProd, true)()
2021
defer test.MockVariableValue(&setting.IsInTesting, false)()
2122

2223
du := NewDateUtils()
@@ -53,6 +54,7 @@ func TestDateTime(t *testing.T) {
5354
func TestTimeSince(t *testing.T) {
5455
testTz, _ := time.LoadLocation("America/New_York")
5556
defer test.MockVariableValue(&setting.DefaultUILocation, testTz)()
57+
defer test.MockVariableValue(&setting.IsProd, true)()
5658
defer test.MockVariableValue(&setting.IsInTesting, false)()
5759

5860
du := NewDateUtils()

modules/templates/util_render.go

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ import (
1414
"unicode"
1515

1616
issues_model "code.gitea.io/gitea/models/issues"
17+
"code.gitea.io/gitea/models/renderhelper"
18+
"code.gitea.io/gitea/models/repo"
1719
"code.gitea.io/gitea/modules/emoji"
1820
"code.gitea.io/gitea/modules/htmlutil"
1921
"code.gitea.io/gitea/modules/log"
@@ -34,11 +36,11 @@ func NewRenderUtils(ctx reqctx.RequestContext) *RenderUtils {
3436
}
3537

3638
// RenderCommitMessage renders commit message with XSS-safe and special links.
37-
func (ut *RenderUtils) RenderCommitMessage(msg string, metas map[string]string) template.HTML {
39+
func (ut *RenderUtils) RenderCommitMessage(msg string, repo *repo.Repository) template.HTML {
3840
cleanMsg := template.HTMLEscapeString(msg)
3941
// we can safely assume that it will not return any error, since there
4042
// shouldn't be any special HTML.
41-
fullMessage, err := markup.PostProcessCommitMessage(markup.NewRenderContext(ut.ctx).WithMetas(metas), cleanMsg)
43+
fullMessage, err := markup.PostProcessCommitMessage(renderhelper.NewRenderContextRepoComment(ut.ctx, repo), cleanMsg)
4244
if err != nil {
4345
log.Error("PostProcessCommitMessage: %v", err)
4446
return ""
@@ -52,7 +54,7 @@ func (ut *RenderUtils) RenderCommitMessage(msg string, metas map[string]string)
5254

5355
// RenderCommitMessageLinkSubject renders commit message as a XSS-safe link to
5456
// the provided default url, handling for special links without email to links.
55-
func (ut *RenderUtils) RenderCommitMessageLinkSubject(msg, urlDefault string, metas map[string]string) template.HTML {
57+
func (ut *RenderUtils) RenderCommitMessageLinkSubject(msg, urlDefault string, repo *repo.Repository) template.HTML {
5658
msgLine := strings.TrimLeftFunc(msg, unicode.IsSpace)
5759
lineEnd := strings.IndexByte(msgLine, '\n')
5860
if lineEnd > 0 {
@@ -63,9 +65,8 @@ func (ut *RenderUtils) RenderCommitMessageLinkSubject(msg, urlDefault string, me
6365
return ""
6466
}
6567

66-
// we can safely assume that it will not return any error, since there
67-
// shouldn't be any special HTML.
68-
renderedMessage, err := markup.PostProcessCommitMessageSubject(markup.NewRenderContext(ut.ctx).WithMetas(metas), urlDefault, template.HTMLEscapeString(msgLine))
68+
// we can safely assume that it will not return any error, since there shouldn't be any special HTML.
69+
renderedMessage, err := markup.PostProcessCommitMessageSubject(renderhelper.NewRenderContextRepoComment(ut.ctx, repo), urlDefault, template.HTMLEscapeString(msgLine))
6970
if err != nil {
7071
log.Error("PostProcessCommitMessageSubject: %v", err)
7172
return ""
@@ -74,7 +75,7 @@ func (ut *RenderUtils) RenderCommitMessageLinkSubject(msg, urlDefault string, me
7475
}
7576

7677
// RenderCommitBody extracts the body of a commit message without its title.
77-
func (ut *RenderUtils) RenderCommitBody(msg string, metas map[string]string) template.HTML {
78+
func (ut *RenderUtils) RenderCommitBody(msg string, repo *repo.Repository) template.HTML {
7879
msgLine := strings.TrimSpace(msg)
7980
lineEnd := strings.IndexByte(msgLine, '\n')
8081
if lineEnd > 0 {
@@ -87,7 +88,7 @@ func (ut *RenderUtils) RenderCommitBody(msg string, metas map[string]string) tem
8788
return ""
8889
}
8990

90-
renderedMessage, err := markup.PostProcessCommitMessage(markup.NewRenderContext(ut.ctx).WithMetas(metas), template.HTMLEscapeString(msgLine))
91+
renderedMessage, err := markup.PostProcessCommitMessage(renderhelper.NewRenderContextRepoComment(ut.ctx, repo), template.HTMLEscapeString(msgLine))
9192
if err != nil {
9293
log.Error("PostProcessCommitMessage: %v", err)
9394
return ""
@@ -105,8 +106,8 @@ func renderCodeBlock(htmlEscapedTextToRender template.HTML) template.HTML {
105106
}
106107

107108
// RenderIssueTitle renders issue/pull title with defined post processors
108-
func (ut *RenderUtils) RenderIssueTitle(text string, metas map[string]string) template.HTML {
109-
renderedText, err := markup.PostProcessIssueTitle(markup.NewRenderContext(ut.ctx).WithMetas(metas), template.HTMLEscapeString(text))
109+
func (ut *RenderUtils) RenderIssueTitle(text string, repo *repo.Repository) template.HTML {
110+
renderedText, err := markup.PostProcessIssueTitle(renderhelper.NewRenderContextRepoComment(ut.ctx, repo), template.HTMLEscapeString(text))
110111
if err != nil {
111112
log.Error("PostProcessIssueTitle: %v", err)
112113
return ""

modules/templates/util_render_legacy.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,22 +32,22 @@ func renderMarkdownToHtmlLegacy(ctx context.Context, input string) template.HTML
3232
return NewRenderUtils(reqctx.FromContext(ctx)).MarkdownToHtml(input)
3333
}
3434

35-
func renderCommitMessageLegacy(ctx context.Context, msg string, metas map[string]string) template.HTML {
35+
func renderCommitMessageLegacy(ctx context.Context, msg string, _ map[string]string) template.HTML {
3636
panicIfDevOrTesting()
37-
return NewRenderUtils(reqctx.FromContext(ctx)).RenderCommitMessage(msg, metas)
37+
return NewRenderUtils(reqctx.FromContext(ctx)).RenderCommitMessage(msg, nil)
3838
}
3939

40-
func renderCommitMessageLinkSubjectLegacy(ctx context.Context, msg, urlDefault string, metas map[string]string) template.HTML {
40+
func renderCommitMessageLinkSubjectLegacy(ctx context.Context, msg, urlDefault string, _ map[string]string) template.HTML {
4141
panicIfDevOrTesting()
42-
return NewRenderUtils(reqctx.FromContext(ctx)).RenderCommitMessageLinkSubject(msg, urlDefault, metas)
42+
return NewRenderUtils(reqctx.FromContext(ctx)).RenderCommitMessageLinkSubject(msg, urlDefault, nil)
4343
}
4444

45-
func renderIssueTitleLegacy(ctx context.Context, text string, metas map[string]string) template.HTML {
45+
func renderIssueTitleLegacy(ctx context.Context, text string, _ map[string]string) template.HTML {
4646
panicIfDevOrTesting()
47-
return NewRenderUtils(reqctx.FromContext(ctx)).RenderIssueTitle(text, metas)
47+
return NewRenderUtils(reqctx.FromContext(ctx)).RenderIssueTitle(text, nil)
4848
}
4949

50-
func renderCommitBodyLegacy(ctx context.Context, msg string, metas map[string]string) template.HTML {
50+
func renderCommitBodyLegacy(ctx context.Context, msg string, _ map[string]string) template.HTML {
5151
panicIfDevOrTesting()
52-
return NewRenderUtils(reqctx.FromContext(ctx)).RenderCommitBody(msg, metas)
52+
return NewRenderUtils(reqctx.FromContext(ctx)).RenderCommitBody(msg, nil)
5353
}

modules/templates/util_render_test.go

Lines changed: 62 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ import (
1111
"testing"
1212

1313
"code.gitea.io/gitea/models/issues"
14-
"code.gitea.io/gitea/models/unittest"
15-
"code.gitea.io/gitea/modules/git"
16-
"code.gitea.io/gitea/modules/log"
14+
"code.gitea.io/gitea/models/repo"
15+
user_model "code.gitea.io/gitea/models/user"
1716
"code.gitea.io/gitea/modules/markup"
1817
"code.gitea.io/gitea/modules/reqctx"
18+
"code.gitea.io/gitea/modules/setting"
1919
"code.gitea.io/gitea/modules/test"
2020
"code.gitea.io/gitea/modules/translation"
2121

@@ -47,19 +47,8 @@ [email protected]
4747
return strings.ReplaceAll(s, "<SPACE>", " ")
4848
}
4949

50-
var testMetas = map[string]string{
51-
"user": "user13",
52-
"repo": "repo11",
53-
"repoPath": "../../tests/gitea-repositories-meta/user13/repo11.git/",
54-
"markdownNewLineHardBreak": "true",
55-
"markupAllowShortIssuePattern": "true",
56-
}
57-
5850
func TestMain(m *testing.M) {
59-
unittest.InitSettingsForTesting()
60-
if err := git.InitSimple(context.Background()); err != nil {
61-
log.Fatal("git init failed, err: %v", err)
62-
}
51+
setting.Markdown.RenderOptionsComment.ShortIssuePattern = true
6352
markup.Init(&markup.RenderHelperFuncs{
6453
IsUsernameMentionable: func(ctx context.Context, username string) bool {
6554
return username == "mention-user"
@@ -74,46 +63,52 @@ func newTestRenderUtils(t *testing.T) *RenderUtils {
7463
return NewRenderUtils(ctx)
7564
}
7665

77-
func TestRenderCommitBody(t *testing.T) {
78-
defer test.MockVariableValue(&markup.RenderBehaviorForTesting.DisableAdditionalAttributes, true)()
79-
type args struct {
80-
msg string
66+
func TestRenderRepoComment(t *testing.T) {
67+
mockRepo := &repo.Repository{
68+
ID: 1, OwnerName: "user13", Name: "repo11",
69+
Owner: &user_model.User{ID: 13, Name: "user13"},
70+
Units: []*repo.RepoUnit{},
8171
}
82-
tests := []struct {
83-
name string
84-
args args
85-
want template.HTML
86-
}{
87-
{
88-
name: "multiple lines",
89-
args: args{
90-
msg: "first line\nsecond line",
72+
t.Run("RenderCommitBody", func(t *testing.T) {
73+
defer test.MockVariableValue(&markup.RenderBehaviorForTesting.DisableAdditionalAttributes, true)()
74+
type args struct {
75+
msg string
76+
}
77+
tests := []struct {
78+
name string
79+
args args
80+
want template.HTML
81+
}{
82+
{
83+
name: "multiple lines",
84+
args: args{
85+
msg: "first line\nsecond line",
86+
},
87+
want: "second line",
9188
},
92-
want: "second line",
93-
},
94-
{
95-
name: "multiple lines with leading newlines",
96-
args: args{
97-
msg: "\n\n\n\nfirst line\nsecond line",
89+
{
90+
name: "multiple lines with leading newlines",
91+
args: args{
92+
msg: "\n\n\n\nfirst line\nsecond line",
93+
},
94+
want: "second line",
9895
},
99-
want: "second line",
100-
},
101-
{
102-
name: "multiple lines with trailing newlines",
103-
args: args{
104-
msg: "first line\nsecond line\n\n\n",
96+
{
97+
name: "multiple lines with trailing newlines",
98+
args: args{
99+
msg: "first line\nsecond line\n\n\n",
100+
},
101+
want: "second line",
105102
},
106-
want: "second line",
107-
},
108-
}
109-
ut := newTestRenderUtils(t)
110-
for _, tt := range tests {
111-
t.Run(tt.name, func(t *testing.T) {
112-
assert.Equalf(t, tt.want, ut.RenderCommitBody(tt.args.msg, nil), "RenderCommitBody(%v, %v)", tt.args.msg, nil)
113-
})
114-
}
115-
116-
expected := `/just/a/path.bin
103+
}
104+
ut := newTestRenderUtils(t)
105+
for _, tt := range tests {
106+
t.Run(tt.name, func(t *testing.T) {
107+
assert.Equalf(t, tt.want, ut.RenderCommitBody(tt.args.msg, mockRepo), "RenderCommitBody(%v, %v)", tt.args.msg, nil)
108+
})
109+
}
110+
111+
expected := `/just/a/path.bin
117112
<a href="https://example.com/file.bin">https://example.com/file.bin</a>
118113
[local link](file.bin)
119114
[remote link](<a href="https://example.com">https://example.com</a>)
@@ -132,22 +127,22 @@ com 88fc37a3c0a4dda553bdcfc80c178a58247f42fb mit
132127
<a href="/mention-user">@mention-user</a> test
133128
<a href="/user13/repo11/issues/123" class="ref-issue">#123</a>
134129
space`
135-
assert.Equal(t, expected, string(newTestRenderUtils(t).RenderCommitBody(testInput(), testMetas)))
136-
}
130+
assert.Equal(t, expected, string(newTestRenderUtils(t).RenderCommitBody(testInput(), mockRepo)))
131+
})
137132

138-
func TestRenderCommitMessage(t *testing.T) {
139-
expected := `space <a href="/mention-user" data-markdown-generated-content="">@mention-user</a> `
140-
assert.EqualValues(t, expected, newTestRenderUtils(t).RenderCommitMessage(testInput(), testMetas))
141-
}
133+
t.Run("RenderCommitMessage", func(t *testing.T) {
134+
expected := `space <a href="/mention-user" data-markdown-generated-content="">@mention-user</a> `
135+
assert.EqualValues(t, expected, newTestRenderUtils(t).RenderCommitMessage(testInput(), mockRepo))
136+
})
142137

143-
func TestRenderCommitMessageLinkSubject(t *testing.T) {
144-
expected := `<a href="https://example.com/link" class="muted">space </a><a href="/mention-user" data-markdown-generated-content="">@mention-user</a>`
145-
assert.EqualValues(t, expected, newTestRenderUtils(t).RenderCommitMessageLinkSubject(testInput(), "https://example.com/link", testMetas))
146-
}
138+
t.Run("RenderCommitMessageLinkSubject", func(t *testing.T) {
139+
expected := `<a href="https://example.com/link" class="muted">space </a><a href="/mention-user" data-markdown-generated-content="">@mention-user</a>`
140+
assert.EqualValues(t, expected, newTestRenderUtils(t).RenderCommitMessageLinkSubject(testInput(), "https://example.com/link", mockRepo))
141+
})
147142

148-
func TestRenderIssueTitle(t *testing.T) {
149-
defer test.MockVariableValue(&markup.RenderBehaviorForTesting.DisableAdditionalAttributes, true)()
150-
expected := ` space @mention-user<SPACE><SPACE>
143+
t.Run("RenderIssueTitle", func(t *testing.T) {
144+
defer test.MockVariableValue(&markup.RenderBehaviorForTesting.DisableAdditionalAttributes, true)()
145+
expected := ` space @mention-user<SPACE><SPACE>
151146
/just/a/path.bin
152147
https://example.com/file.bin
153148
[local link](file.bin)
@@ -168,8 +163,9 @@ [email protected]
168163
<a href="/user13/repo11/issues/123" class="ref-issue">#123</a>
169164
space<SPACE><SPACE>
170165
`
171-
expected = strings.ReplaceAll(expected, "<SPACE>", " ")
172-
assert.Equal(t, expected, string(newTestRenderUtils(t).RenderIssueTitle(testInput(), testMetas)))
166+
expected = strings.ReplaceAll(expected, "<SPACE>", " ")
167+
assert.Equal(t, expected, string(newTestRenderUtils(t).RenderIssueTitle(testInput(), mockRepo)))
168+
})
173169
}
174170

175171
func TestRenderMarkdownToHtml(t *testing.T) {

routers/web/feed/convert.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,15 +201,15 @@ func feedActionsToFeedItems(ctx *context.Context, actions activities_model.Actio
201201
switch act.OpType {
202202
case activities_model.ActionCommitRepo, activities_model.ActionMirrorSyncPush:
203203
push := templates.ActionContent2Commits(act)
204-
204+
_ = act.LoadRepo(ctx)
205205
for _, commit := range push.Commits {
206206
if len(desc) != 0 {
207207
desc += "\n\n"
208208
}
209209
desc += fmt.Sprintf("<a href=\"%s\">%s</a>\n%s",
210210
html.EscapeString(fmt.Sprintf("%s/commit/%s", act.GetRepoAbsoluteLink(ctx), commit.Sha1)),
211211
commit.Sha1,
212-
renderUtils.RenderCommitMessage(commit.Message, nil),
212+
renderUtils.RenderCommitMessage(commit.Message, act.Repo),
213213
)
214214
}
215215

routers/web/repo/actions/view.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -200,13 +200,9 @@ func ViewPost(ctx *context_module.Context) {
200200
}
201201
}
202202

203-
// TODO: "ComposeCommentMetas" (usually for comment) is not quite right, but it is still the same as what template "RenderCommitMessage" does.
204-
// need to be refactored together in the future
205-
metas := ctx.Repo.Repository.ComposeCommentMetas(ctx)
206-
207203
// the title for the "run" is from the commit message
208204
resp.State.Run.Title = run.Title
209-
resp.State.Run.TitleHTML = templates.NewRenderUtils(ctx).RenderCommitMessage(run.Title, metas)
205+
resp.State.Run.TitleHTML = templates.NewRenderUtils(ctx).RenderCommitMessage(run.Title, ctx.Repo.Repository)
210206
resp.State.Run.Link = run.Link()
211207
resp.State.Run.CanCancel = !run.Status.IsDone() && ctx.Repo.CanWrite(unit.TypeActions)
212208
resp.State.Run.CanApprove = run.NeedApproval && ctx.Repo.CanWrite(unit.TypeActions)

templates/repo/branch/list.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<button class="btn interact-fg tw-px-1" data-clipboard-text="{{.DefaultBranchBranch.DBBranch.Name}}" data-tooltip-content="{{ctx.Locale.Tr "copy_branch"}}">{{svg "octicon-copy" 14}}</button>
2828
{{template "repo/commit_statuses" dict "Status" (index $.CommitStatus .DefaultBranchBranch.DBBranch.CommitID) "Statuses" (index $.CommitStatuses .DefaultBranchBranch.DBBranch.CommitID)}}
2929
</div>
30-
<p class="info tw-flex tw-items-center tw-my-1">{{svg "octicon-git-commit" 16 "tw-mr-1"}}<a href="{{.RepoLink}}/commit/{{PathEscape .DefaultBranchBranch.DBBranch.CommitID}}">{{ShortSha .DefaultBranchBranch.DBBranch.CommitID}}</a> · <span class="commit-message">{{ctx.RenderUtils.RenderCommitMessage .DefaultBranchBranch.DBBranch.CommitMessage (.Repository.ComposeCommentMetas ctx)}}</span> · {{ctx.Locale.Tr "org.repo_updated"}} {{DateUtils.TimeSince .DefaultBranchBranch.DBBranch.CommitTime}}{{if .DefaultBranchBranch.DBBranch.Pusher}} &nbsp;{{template "shared/user/avatarlink" dict "user" .DefaultBranchBranch.DBBranch.Pusher}}{{template "shared/user/namelink" .DefaultBranchBranch.DBBranch.Pusher}}{{end}}</p>
30+
<p class="info tw-flex tw-items-center tw-my-1">{{svg "octicon-git-commit" 16 "tw-mr-1"}}<a href="{{.RepoLink}}/commit/{{PathEscape .DefaultBranchBranch.DBBranch.CommitID}}">{{ShortSha .DefaultBranchBranch.DBBranch.CommitID}}</a> · <span class="commit-message">{{ctx.RenderUtils.RenderCommitMessage .DefaultBranchBranch.DBBranch.CommitMessage .Repository}}</span> · {{ctx.Locale.Tr "org.repo_updated"}} {{DateUtils.TimeSince .DefaultBranchBranch.DBBranch.CommitTime}}{{if .DefaultBranchBranch.DBBranch.Pusher}} &nbsp;{{template "shared/user/avatarlink" dict "user" .DefaultBranchBranch.DBBranch.Pusher}}{{template "shared/user/namelink" .DefaultBranchBranch.DBBranch.Pusher}}{{end}}</p>
3131
</td>
3232
{{/* FIXME: here and below, the tw-overflow-visible is not quite right but it is still needed the moment: to show the important buttons when the width is narrow */}}
3333
<td class="tw-text-right tw-overflow-visible">
@@ -103,7 +103,7 @@
103103
<button class="btn interact-fg tw-px-1" data-clipboard-text="{{.DBBranch.Name}}" data-tooltip-content="{{ctx.Locale.Tr "copy_branch"}}">{{svg "octicon-copy" 14}}</button>
104104
{{template "repo/commit_statuses" dict "Status" (index $.CommitStatus .DBBranch.CommitID) "Statuses" (index $.CommitStatuses .DBBranch.CommitID)}}
105105
</div>
106-
<p class="info tw-flex tw-items-center tw-my-1">{{svg "octicon-git-commit" 16 "tw-mr-1"}}<a href="{{$.RepoLink}}/commit/{{PathEscape .DBBranch.CommitID}}">{{ShortSha .DBBranch.CommitID}}</a> · <span class="commit-message">{{ctx.RenderUtils.RenderCommitMessage .DBBranch.CommitMessage ($.Repository.ComposeCommentMetas ctx)}}</span> · {{ctx.Locale.Tr "org.repo_updated"}} {{DateUtils.TimeSince .DBBranch.CommitTime}}{{if .DBBranch.Pusher}} &nbsp;{{template "shared/user/avatarlink" dict "user" .DBBranch.Pusher}} &nbsp;{{template "shared/user/namelink" .DBBranch.Pusher}}{{end}}</p>
106+
<p class="info tw-flex tw-items-center tw-my-1">{{svg "octicon-git-commit" 16 "tw-mr-1"}}<a href="{{$.RepoLink}}/commit/{{PathEscape .DBBranch.CommitID}}">{{ShortSha .DBBranch.CommitID}}</a> · <span class="commit-message">{{ctx.RenderUtils.RenderCommitMessage .DBBranch.CommitMessage $.Repository}}</span> · {{ctx.Locale.Tr "org.repo_updated"}} {{DateUtils.TimeSince .DBBranch.CommitTime}}{{if .DBBranch.Pusher}} &nbsp;{{template "shared/user/avatarlink" dict "user" .DBBranch.Pusher}} &nbsp;{{template "shared/user/namelink" .DBBranch.Pusher}}{{end}}</p>
107107
{{end}}
108108
</td>
109109
<td class="two wide ui">

templates/repo/commit_page.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<div class="ui container fluid padded">
66
<div class="ui top attached header clearing segment tw-relative commit-header">
77
<div class="tw-flex tw-mb-4 tw-gap-1">
8-
<h3 class="tw-mb-0 tw-flex-1"><span class="commit-summary" title="{{.Commit.Summary}}">{{ctx.RenderUtils.RenderCommitMessage .Commit.Message ($.Repository.ComposeCommentMetas ctx)}}</span>{{template "repo/commit_statuses" dict "Status" .CommitStatus "Statuses" .CommitStatuses}}</h3>
8+
<h3 class="tw-mb-0 tw-flex-1"><span class="commit-summary" title="{{.Commit.Summary}}">{{ctx.RenderUtils.RenderCommitMessage .Commit.Message $.Repository}}</span>{{template "repo/commit_statuses" dict "Status" .CommitStatus "Statuses" .CommitStatuses}}</h3>
99
{{if not $.PageIsWiki}}
1010
<div class="commit-header-buttons">
1111
<a class="ui primary tiny button" href="{{.SourcePath}}">
@@ -122,7 +122,7 @@
122122
{{end}}
123123
</div>
124124
{{if IsMultilineCommitMessage .Commit.Message}}
125-
<pre class="commit-body">{{ctx.RenderUtils.RenderCommitBody .Commit.Message ($.Repository.ComposeCommentMetas ctx)}}</pre>
125+
<pre class="commit-body">{{ctx.RenderUtils.RenderCommitBody .Commit.Message $.Repository}}</pre>
126126
{{end}}
127127
{{template "repo/commit_load_branches_and_tags" .}}
128128
</div>

0 commit comments

Comments
 (0)