Skip to content

Commit 3604b7d

Browse files
authored
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.
1 parent d41d367 commit 3604b7d

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

routers/web/repo/pull_review.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,8 @@ func UpdateResolveConversation(ctx *context.Context) {
156156
func renderConversation(ctx *context.Context, comment *issues_model.Comment, origin string) {
157157
ctx.Data["PageIsPullFiles"] = origin == "diff"
158158

159-
comments, err := issues_model.FetchCodeCommentsByLine(ctx, comment.Issue, ctx.Doer, comment.TreePath, comment.Line, ctx.Data["ShowOutdatedComments"].(bool))
159+
showOutdatedComments := origin == "timeline" || ctx.Data["ShowOutdatedComments"].(bool)
160+
comments, err := issues_model.FetchCodeCommentsByLine(ctx, comment.Issue, ctx.Doer, comment.TreePath, comment.Line, showOutdatedComments)
160161
if err != nil {
161162
ctx.ServerError("FetchCodeCommentsByLine", err)
162163
return

routers/web/repo/pull_review_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ func TestRenderConversation(t *testing.T) {
6868
renderConversation(ctx, preparedComment, "timeline")
6969
assert.Contains(t, resp.Body.String(), `<div id="code-comments-`)
7070
})
71-
run("timeline without outdated", func(t *testing.T, ctx *context.Context, resp *httptest.ResponseRecorder) {
71+
run("timeline is not affected by ShowOutdatedComments=false", func(t *testing.T, ctx *context.Context, resp *httptest.ResponseRecorder) {
7272
ctx.Data["ShowOutdatedComments"] = false
7373
renderConversation(ctx, preparedComment, "timeline")
74-
assert.Contains(t, resp.Body.String(), `conversation-not-existing`)
74+
assert.Contains(t, resp.Body.String(), `<div id="code-comments-`)
7575
})
7676
}

0 commit comments

Comments
 (0)