1
0
Fork 0
forked from forgejo/forgejo

[BUG] split code conversations in diff tab (#2306)

Follow-up of #2282 and #2296 (which tried to address #2278)

One of the issue with the previous PR is that when a conversation on the Files tab was marked as "resolved", it would fetch all the comments for that line (even the outdated ones, which should not be shown on this page - except when explicitly activated).

To properly fix this, I have changed `FetchCodeCommentsByLine` to `FetchCodeConversation`. Its role is to fetch all comments related to a given (review, path, line) and reverted my changes in the template (which were based on a misunderstanding).

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2306
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: oliverpool <git@olivier.pfad.fr>
Co-committed-by: oliverpool <git@olivier.pfad.fr>
This commit is contained in:
oliverpool 2024-02-16 12:16:11 +00:00
parent 45c0fa4905
commit 07bc099401
11 changed files with 348 additions and 144 deletions

View file

@ -53,11 +53,11 @@ func TestGetDiffPreview(t *testing.T) {
Name: "",
Lines: []*gitdiff.DiffLine{
{
LeftIdx: 0,
RightIdx: 0,
Type: 4,
Content: "@@ -1,3 +1,4 @@",
Comments: nil,
LeftIdx: 0,
RightIdx: 0,
Type: 4,
Content: "@@ -1,3 +1,4 @@",
Conversations: nil,
SectionInfo: &gitdiff.DiffLineSectionInfo{
Path: "README.md",
LastLeftIdx: 0,
@ -69,42 +69,42 @@ func TestGetDiffPreview(t *testing.T) {
},
},
{
LeftIdx: 1,
RightIdx: 1,
Type: 1,
Content: " # repo1",
Comments: nil,
LeftIdx: 1,
RightIdx: 1,
Type: 1,
Content: " # repo1",
Conversations: nil,
},
{
LeftIdx: 2,
RightIdx: 2,
Type: 1,
Content: " ",
Comments: nil,
LeftIdx: 2,
RightIdx: 2,
Type: 1,
Content: " ",
Conversations: nil,
},
{
LeftIdx: 3,
RightIdx: 0,
Match: 4,
Type: 3,
Content: "-Description for repo1",
Comments: nil,
LeftIdx: 3,
RightIdx: 0,
Match: 4,
Type: 3,
Content: "-Description for repo1",
Conversations: nil,
},
{
LeftIdx: 0,
RightIdx: 3,
Match: 3,
Type: 2,
Content: "+Description for repo1",
Comments: nil,
LeftIdx: 0,
RightIdx: 3,
Match: 3,
Type: 2,
Content: "+Description for repo1",
Conversations: nil,
},
{
LeftIdx: 0,
RightIdx: 4,
Match: -1,
Type: 2,
Content: "+this is a new line",
Comments: nil,
LeftIdx: 0,
RightIdx: 4,
Match: -1,
Type: 2,
Content: "+this is a new line",
Conversations: nil,
},
},
},