Skip to content

Commit a65f0f6

Browse files
committed
allow comments on non-diff lines (#32257)
Signed-off-by: abhishek818 <[email protected]>
1 parent 81aec6d commit a65f0f6

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

services/gitdiff/gitdiff.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ func (d *DiffLine) GetHTMLDiffLineType() string {
118118

119119
// CanComment returns whether a line can get commented
120120
func (d *DiffLine) CanComment() bool {
121-
return len(d.Comments) == 0 && d.Type != DiffLineSection
121+
return len(d.Comments) == 0
122122
}
123123

124124
// GetCommentSide returns the comment side of the first comment, if not set returns empty string

services/gitdiff/gitdiff_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@ func TestDiff_LoadCommentsWithOutdated(t *testing.T) {
615615
}
616616

617617
func TestDiffLine_CanComment(t *testing.T) {
618-
assert.False(t, (&DiffLine{Type: DiffLineSection}).CanComment())
618+
assert.True(t, (&DiffLine{Type: DiffLineSection}).CanComment())
619619
assert.False(t, (&DiffLine{Type: DiffLineAdd, Comments: []*issues_model.Comment{{Content: "bla"}}}).CanComment())
620620
assert.True(t, (&DiffLine{Type: DiffLineAdd}).CanComment())
621621
assert.True(t, (&DiffLine{Type: DiffLineDel}).CanComment())

0 commit comments

Comments
 (0)