Skip to content

Commit

Permalink
allow comments on non-diff lines (#32257)
Browse files Browse the repository at this point in the history
Signed-off-by: abhishek818 <[email protected]>
  • Loading branch information
abhishek818 committed Oct 14, 2024
1 parent 81aec6d commit a65f0f6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion services/gitdiff/gitdiff.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ func (d *DiffLine) GetHTMLDiffLineType() string {

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

// GetCommentSide returns the comment side of the first comment, if not set returns empty string
Expand Down
2 changes: 1 addition & 1 deletion services/gitdiff/gitdiff_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ func TestDiff_LoadCommentsWithOutdated(t *testing.T) {
}

func TestDiffLine_CanComment(t *testing.T) {
assert.False(t, (&DiffLine{Type: DiffLineSection}).CanComment())
assert.True(t, (&DiffLine{Type: DiffLineSection}).CanComment())
assert.False(t, (&DiffLine{Type: DiffLineAdd, Comments: []*issues_model.Comment{{Content: "bla"}}}).CanComment())
assert.True(t, (&DiffLine{Type: DiffLineAdd}).CanComment())
assert.True(t, (&DiffLine{Type: DiffLineDel}).CanComment())
Expand Down

0 comments on commit a65f0f6

Please sign in to comment.