From 3c9b176348e32c7d7356e175b083752f06ff53aa Mon Sep 17 00:00:00 2001 From: oliverpool Date: Tue, 27 Feb 2024 16:05:59 +0100 Subject: [PATCH] fix cherry-pick --- routers/web/repo/pull.go | 10 ++++++---- routers/web/repo/pull_review_test.go | 6 ++++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/routers/web/repo/pull.go b/routers/web/repo/pull.go index 229016fcb..561039c41 100644 --- a/routers/web/repo/pull.go +++ b/routers/web/repo/pull.go @@ -989,10 +989,12 @@ func viewPullFiles(ctx *context.Context, specifiedStartCommit, specifiedEndCommi for _, file := range diff.Files { for _, section := range file.Sections { for _, line := range section.Lines { - for _, comment := range line.Comments { - if err := comment.LoadAttachments(ctx); err != nil { - ctx.ServerError("LoadAttachments", err) - return + for _, comments := range line.Conversations { + for _, comment := range comments { + if err := comment.LoadAttachments(ctx); err != nil { + ctx.ServerError("LoadAttachments", err) + return + } } } } diff --git a/routers/web/repo/pull_review_test.go b/routers/web/repo/pull_review_test.go index 8fc9cecaf..68f68d7bb 100644 --- a/routers/web/repo/pull_review_test.go +++ b/routers/web/repo/pull_review_test.go @@ -28,7 +28,8 @@ func TestRenderConversation(t *testing.T) { run := func(name string, cb func(t *testing.T, ctx *context.Context, resp *httptest.ResponseRecorder)) { t.Run(name, func(t *testing.T) { - ctx, resp := contexttest.MockContext(t, "/", contexttest.MockContextOption{Render: templates.HTMLRenderer()}) + ctx, resp := contexttest.MockContext(t, "/") + ctx.Render = templates.HTMLRenderer() contexttest.LoadUser(t, ctx, pr.Issue.PosterID) contexttest.LoadRepo(t, ctx, pr.BaseRepoID) contexttest.LoadGitRepo(t, ctx) @@ -61,7 +62,8 @@ func TestRenderConversation(t *testing.T) { run("diff without outdated", func(t *testing.T, ctx *context.Context, resp *httptest.ResponseRecorder) { ctx.Data["ShowOutdatedComments"] = false renderConversation(ctx, preparedComment, "diff") - assert.Contains(t, resp.Body.String(), `conversation-not-existing`) + // unlike gitea, Forgejo renders the conversation (with the "outdated" label) + assert.Contains(t, resp.Body.String(), `repo.issues.review.outdated_description`) }) run("timeline with outdated", func(t *testing.T, ctx *context.Context, resp *httptest.ResponseRecorder) { ctx.Data["ShowOutdatedComments"] = true