1
0
Fork 0
forked from forgejo/forgejo

Check ctx.Written() for GetActionIssue (#25698) (#25711)

Backport #25698 by @wolfogre

Fix #25697.

Just avoid panic, maybe there's another bug to trigger this case.

Co-authored-by: Jason Song <i@wolfogre.com>
This commit is contained in:
Giteabot 2023-07-06 15:04:26 -04:00 committed by GitHub
parent 68e0c802f7
commit 03cacf971e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 20 additions and 11 deletions

View file

@ -28,6 +28,9 @@ const (
// RenderNewCodeCommentForm will render the form for creating a new review comment
func RenderNewCodeCommentForm(ctx *context.Context) {
issue := GetActionIssue(ctx)
if ctx.Written() {
return
}
if !issue.IsPull {
return
}
@ -52,10 +55,10 @@ func RenderNewCodeCommentForm(ctx *context.Context) {
func CreateCodeComment(ctx *context.Context) {
form := web.GetForm(ctx).(*forms.CodeCommentForm)
issue := GetActionIssue(ctx)
if !issue.IsPull {
if ctx.Written() {
return
}
if ctx.Written() {
if !issue.IsPull {
return
}
@ -185,10 +188,10 @@ func renderConversation(ctx *context.Context, comment *issues_model.Comment) {
func SubmitReview(ctx *context.Context) {
form := web.GetForm(ctx).(*forms.SubmitReviewForm)
issue := GetActionIssue(ctx)
if !issue.IsPull {
if ctx.Written() {
return
}
if ctx.Written() {
if !issue.IsPull {
return
}
if ctx.HasError() {