Skip to content

Commit 61619c8

Browse files
authored
Fix 500 error when adding PR comment (#29622)
1 parent c481dba commit 61619c8

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

routers/web/repo/pull_review.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010

1111
issues_model "code.gitea.io/gitea/models/issues"
1212
pull_model "code.gitea.io/gitea/models/pull"
13+
user_model "code.gitea.io/gitea/models/user"
1314
"code.gitea.io/gitea/modules/base"
1415
"code.gitea.io/gitea/modules/json"
1516
"code.gitea.io/gitea/modules/log"
@@ -19,6 +20,7 @@ import (
1920
"code.gitea.io/gitea/services/context/upload"
2021
"code.gitea.io/gitea/services/forms"
2122
pull_service "code.gitea.io/gitea/services/pull"
23+
user_service "code.gitea.io/gitea/services/user"
2224
)
2325

2426
const (
@@ -203,6 +205,10 @@ func renderConversation(ctx *context.Context, comment *issues_model.Comment, ori
203205
return
204206
}
205207
ctx.Data["AfterCommitID"] = pullHeadCommitID
208+
ctx.Data["CanBlockUser"] = func(blocker, blockee *user_model.User) bool {
209+
return user_service.CanBlockUser(ctx, ctx.Doer, blocker, blockee)
210+
}
211+
206212
if origin == "diff" {
207213
ctx.HTML(http.StatusOK, tplDiffConversation)
208214
} else if origin == "timeline" {

0 commit comments

Comments
 (0)