1
1
mirror of https://github.com/go-gitea/gitea synced 2024-12-22 16:44:26 +00:00

allow comments on non-diff lines (#32257)

Signed-off-by: abhishek818 <abhishekguptaatweb17@gmail.com>
This commit is contained in:
abhishek818 2024-10-14 23:50:59 +05:30
parent 81aec6d621
commit a65f0f6970
2 changed files with 2 additions and 2 deletions

View File

@ -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

View File

@ -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())