Skip to content

Commit bc75226

Browse files
committed
fix template
1 parent 20931e3 commit bc75226

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

modules/templates/helper.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import (
2727
"code.gitea.io/gitea/modules/setting"
2828
"code.gitea.io/gitea/modules/timeutil"
2929
"code.gitea.io/gitea/modules/util"
30+
"code.gitea.io/gitea/services/gitdiff"
3031

3132
"gopkg.in/editorconfig/editorconfig-core-go.v1"
3233
)
@@ -230,6 +231,7 @@ func NewFuncMap() []template.FuncMap {
230231
}
231232
return float32(n) * 100 / float32(sum)
232233
},
234+
"MustAsDiff": gitdiff.CommentMustAsDiff,
233235
}}
234236
}
235237

services/gitdiff/gitdiff.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -822,7 +822,7 @@ func CommentAsDiff(c *models.Comment) (*Diff, error) {
822822
func CommentMustAsDiff(c *models.Comment) *Diff {
823823
diff, err := CommentAsDiff(c)
824824
if err != nil {
825-
log.Warn("MustAsDiff: %v", err)
825+
log.Warn("CommentMustAsDiff: %v", err)
826826
}
827827
return diff
828828
}

templates/repo/issue/view_content/comments.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@
319319
{{end}}
320320
<a href="{{(index $comms 0).CodeCommentURL}}" class="file-comment">{{$filename}}</a>
321321
</div>
322-
{{$diff := ((index $comms 0).MustAsDiff)}}
322+
{{$diff := (CommentMustAsDiff (index $comms 0))}}
323323
{{if $diff}}
324324
{{$file := (index $diff.Files 0)}}
325325
<div id="code-preview-{{(index $comms 0).ID}}" class="ui table segment{{if $invalid}} hide{{end}}">

0 commit comments

Comments
 (0)