diff --git a/models/git_diff.go b/models/git_diff.go index f72e8e1b3..44027bec6 100644 --- a/models/git_diff.go +++ b/models/git_diff.go @@ -67,6 +67,10 @@ func (d *DiffLine) GetType() int { return int(d.Type) } +func (d *DiffLine) CanComment() bool { + return len(d.Comments) == 0 && d.Type != DiffLineSection +} + // GetCommentSide returns the comment side of the first comment, if not set returns empty string func (d *DiffLine) GetCommentSide() string { if len(d.Comments) == 0 { diff --git a/templates/repo/diff/box.tmpl b/templates/repo/diff/box.tmpl index 39a66a734..77a0e955e 100644 --- a/templates/repo/diff/box.tmpl +++ b/templates/repo/diff/box.tmpl @@ -106,7 +106,7 @@
{{if $line.LeftIdx}}{{$section.GetComputedInlineDiffFor $line}}{{end}}
@@ -116,7 +116,7 @@
{{if $line.RightIdx}}{{$section.GetComputedInlineDiffFor $line}}{{end}}
diff --git a/templates/repo/diff/section_unified.tmpl b/templates/repo/diff/section_unified.tmpl
index f089df4c2..491572cde 100644
--- a/templates/repo/diff/section_unified.tmpl
+++ b/templates/repo/diff/section_unified.tmpl
@@ -16,7 +16,7 @@
{{$section.GetComputedInlineDiffFor $line}}