0
0
Fork 0
mirror of https://github.com/go-gitea/gitea synced 2024-11-07 06:39:16 +01:00

Fix 500 error when adding PR comment (#29622)

This commit is contained in:
wxiaoguang 2024-03-06 13:09:38 +08:00 committed by GitHub
parent c481dba52c
commit 61619c84d0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -10,6 +10,7 @@ import (
issues_model "code.gitea.io/gitea/models/issues" issues_model "code.gitea.io/gitea/models/issues"
pull_model "code.gitea.io/gitea/models/pull" 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/base"
"code.gitea.io/gitea/modules/json" "code.gitea.io/gitea/modules/json"
"code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/log"
@ -19,6 +20,7 @@ import (
"code.gitea.io/gitea/services/context/upload" "code.gitea.io/gitea/services/context/upload"
"code.gitea.io/gitea/services/forms" "code.gitea.io/gitea/services/forms"
pull_service "code.gitea.io/gitea/services/pull" pull_service "code.gitea.io/gitea/services/pull"
user_service "code.gitea.io/gitea/services/user"
) )
const ( const (
@ -203,6 +205,10 @@ func renderConversation(ctx *context.Context, comment *issues_model.Comment, ori
return return
} }
ctx.Data["AfterCommitID"] = pullHeadCommitID 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" { if origin == "diff" {
ctx.HTML(http.StatusOK, tplDiffConversation) ctx.HTML(http.StatusOK, tplDiffConversation)
} else if origin == "timeline" { } else if origin == "timeline" {