fix {DELETE,POST} /repos/{owner}/{repo}/issues/comments/{id}/reactions

(cherry picked from commit f499075c53752f983c6e4f8af17c449926ba94d9)
This commit is contained in:
Loïc Dachary 2023-11-02 15:14:32 +01:00
parent f59a6cc0e4
commit 685ebdba63
No known key found for this signature in database
GPG key ID: 992D23B392F9E4F2

View file

@ -186,9 +186,19 @@ func changeIssueCommentReaction(ctx *context.APIContext, form api.EditReactionOp
return return
} }
err = comment.LoadIssue(ctx) if err = comment.LoadIssue(ctx); err != nil {
if err != nil {
ctx.Error(http.StatusInternalServerError, "comment.LoadIssue() failed", err) ctx.Error(http.StatusInternalServerError, "comment.LoadIssue() failed", err)
return
}
if comment.Issue.RepoID != ctx.Repo.Repository.ID {
ctx.NotFound()
return
}
if !ctx.Repo.CanReadIssuesOrPulls(comment.Issue.IsPull) {
ctx.NotFound()
return
} }
if comment.Issue.IsLocked && !ctx.Repo.CanWriteIssuesOrPulls(comment.Issue.IsPull) { if comment.Issue.IsLocked && !ctx.Repo.CanWriteIssuesOrPulls(comment.Issue.IsPull) {