From 61619c84d0fc511f2532f8c82d98fe971da69447 Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Wed, 6 Mar 2024 13:09:38 +0800 Subject: [PATCH] Fix 500 error when adding PR comment (#29622) --- routers/web/repo/pull_review.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/routers/web/repo/pull_review.go b/routers/web/repo/pull_review.go index 64212291e1..bce807aacd 100644 --- a/routers/web/repo/pull_review.go +++ b/routers/web/repo/pull_review.go @@ -10,6 +10,7 @@ import ( issues_model "code.gitea.io/gitea/models/issues" pull_model "code.gitea.io/gitea/models/pull" + user_model "code.gitea.io/gitea/models/user" "code.gitea.io/gitea/modules/base" "code.gitea.io/gitea/modules/json" "code.gitea.io/gitea/modules/log" @@ -19,6 +20,7 @@ import ( "code.gitea.io/gitea/services/context/upload" "code.gitea.io/gitea/services/forms" pull_service "code.gitea.io/gitea/services/pull" + user_service "code.gitea.io/gitea/services/user" ) const ( @@ -203,6 +205,10 @@ func renderConversation(ctx *context.Context, comment *issues_model.Comment, ori return } ctx.Data["AfterCommitID"] = pullHeadCommitID + ctx.Data["CanBlockUser"] = func(blocker, blockee *user_model.User) bool { + return user_service.CanBlockUser(ctx, ctx.Doer, blocker, blockee) + } + if origin == "diff" { ctx.HTML(http.StatusOK, tplDiffConversation) } else if origin == "timeline" {