mirror of
https://github.com/go-gitea/gitea.git
synced 2024-11-04 08:17:24 -05:00
Load outdated comments when (un)resolving conversation on PR timeline (#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.
This commit is contained in:
parent
aa6f88638f
commit
22b9c2c95c
@ -156,7 +156,8 @@ func UpdateResolveConversation(ctx *context.Context) {
|
|||||||
func renderConversation(ctx *context.Context, comment *issues_model.Comment, origin string) {
|
func renderConversation(ctx *context.Context, comment *issues_model.Comment, origin string) {
|
||||||
ctx.Data["PageIsPullFiles"] = origin == "diff"
|
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 {
|
if err != nil {
|
||||||
ctx.ServerError("FetchCodeCommentsByLine", err)
|
ctx.ServerError("FetchCodeCommentsByLine", err)
|
||||||
return
|
return
|
||||||
|
@ -68,9 +68,9 @@ func TestRenderConversation(t *testing.T) {
|
|||||||
renderConversation(ctx, preparedComment, "timeline")
|
renderConversation(ctx, preparedComment, "timeline")
|
||||||
assert.Contains(t, resp.Body.String(), `<div id="code-comments-`)
|
assert.Contains(t, resp.Body.String(), `<div id="code-comments-`)
|
||||||
})
|
})
|
||||||
run("timeline without outdated", func(t *testing.T, ctx *context.Context, resp *httptest.ResponseRecorder) {
|
run("timeline is not affected by ShowOutdatedComments=false", func(t *testing.T, ctx *context.Context, resp *httptest.ResponseRecorder) {
|
||||||
ctx.Data["ShowOutdatedComments"] = false
|
ctx.Data["ShowOutdatedComments"] = false
|
||||||
renderConversation(ctx, preparedComment, "timeline")
|
renderConversation(ctx, preparedComment, "timeline")
|
||||||
assert.Contains(t, resp.Body.String(), `conversation-not-existing`)
|
assert.Contains(t, resp.Body.String(), `<div id="code-comments-`)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user