From 49b51cbdd709c9c3d9b4a5666a4f8cce280584c9 Mon Sep 17 00:00:00 2001 From: Earl Warren Date: Mon, 5 Feb 2024 16:19:45 +0100 Subject: [PATCH] Revert "Do not render empty comments (#29039)" This reverts commit b4513f48ce3e748ac621a6f3ddf082feca67e938. --- routers/web/repo/pull_review.go | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/routers/web/repo/pull_review.go b/routers/web/repo/pull_review.go index a6b3bd1c8..156b70a99 100644 --- a/routers/web/repo/pull_review.go +++ b/routers/web/repo/pull_review.go @@ -153,19 +153,12 @@ 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)) if err != nil { ctx.ServerError("FetchCodeCommentsByLine", err) return } - if len(comments) == 0 { - // if the comments are empty (deleted, outdated, etc), it doesn't need to render anything, just return an empty body to replace "conversation-holder" on the page - ctx.Resp.WriteHeader(http.StatusOK) - return - } - + ctx.Data["PageIsPullFiles"] = (origin == "diff") ctx.Data["comments"] = comments if ctx.Data["CanMarkConversation"], err = issues_model.CanMarkConversation(ctx, comment.Issue, ctx.Doer); err != nil { ctx.ServerError("CanMarkConversation", err) @@ -186,8 +179,6 @@ func renderConversation(ctx *context.Context, comment *issues_model.Comment, ori ctx.HTML(http.StatusOK, tplDiffConversation) } else if origin == "timeline" { ctx.HTML(http.StatusOK, tplTimelineConversation) - } else { - ctx.Error(http.StatusBadRequest, "Unknown origin: "+origin) } }