From 3604b7d8ad207fbcb9e6bafa3155446dc32763ab Mon Sep 17 00:00:00 2001 From: Jimmy Praet Date: Sun, 18 Feb 2024 07:58:26 +0100 Subject: [PATCH] Load outdated comments when (un)resolving conversation on PR timeline (#29203) (#29221) Backport #29203 Relates to #28654, #29039 and #29050. The "show outdated comments" flag should only apply to the file diff view. On the PR timeline, outdated comments are always shown. So they should also be loaded when (un)resolving a conversation on the timeline page. --- routers/web/repo/pull_review.go | 3 ++- routers/web/repo/pull_review_test.go | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/routers/web/repo/pull_review.go b/routers/web/repo/pull_review.go index b93460d1696a..bdd5544923dc 100644 --- a/routers/web/repo/pull_review.go +++ b/routers/web/repo/pull_review.go @@ -156,7 +156,8 @@ func UpdateResolveConversation(ctx *context.Context) { func renderConversation(ctx *context.Context, comment *issues_model.Comment, origin string) { ctx.Data["PageIsPullFiles"] = origin == "diff" - comments, err := issues_model.FetchCodeCommentsByLine(ctx, comment.Issue, ctx.Doer, comment.TreePath, comment.Line, ctx.Data["ShowOutdatedComments"].(bool)) + showOutdatedComments := origin == "timeline" || ctx.Data["ShowOutdatedComments"].(bool) + comments, err := issues_model.FetchCodeCommentsByLine(ctx, comment.Issue, ctx.Doer, comment.TreePath, comment.Line, showOutdatedComments) if err != nil { ctx.ServerError("FetchCodeCommentsByLine", err) return diff --git a/routers/web/repo/pull_review_test.go b/routers/web/repo/pull_review_test.go index 65019af40b16..7e6594774a84 100644 --- a/routers/web/repo/pull_review_test.go +++ b/routers/web/repo/pull_review_test.go @@ -68,9 +68,9 @@ func TestRenderConversation(t *testing.T) { renderConversation(ctx, preparedComment, "timeline") assert.Contains(t, resp.Body.String(), `