Compare commits

...

2 Commits

Author SHA1 Message Date
Abhishek Kumar Gupta
68152e4d4b
Merge a65f0f697040b6ec09f17713c7ab9239d725abd7 into 1d4ad5aa2b3a321a8d759bb91fc78e0aa6a89ed9 2025-07-02 00:39:46 +09:00
abhishek818
a65f0f6970 allow comments on non-diff lines (#32257)
Signed-off-by: abhishek818 <abhishekguptaatweb17@gmail.com>
2024-10-15 00:10:03 +05:30
2 changed files with 2 additions and 2 deletions

View File

@ -130,7 +130,7 @@ func (d *DiffLine) GetHTMLDiffLineType() string {
// CanComment returns whether a line can get commented // CanComment returns whether a line can get commented
func (d *DiffLine) CanComment() bool { 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 // GetCommentSide returns the comment side of the first comment, if not set returns empty string

View File

@ -586,7 +586,7 @@ func TestDiff_LoadCommentsWithOutdated(t *testing.T) {
} }
func TestDiffLine_CanComment(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.False(t, (&DiffLine{Type: DiffLineAdd, Comments: []*issues_model.Comment{{Content: "bla"}}}).CanComment())
assert.True(t, (&DiffLine{Type: DiffLineAdd}).CanComment()) assert.True(t, (&DiffLine{Type: DiffLineAdd}).CanComment())
assert.True(t, (&DiffLine{Type: DiffLineDel}).CanComment()) assert.True(t, (&DiffLine{Type: DiffLineDel}).CanComment())