fix DELETE /api/v1/repos/{owner}/{repo}/issues/comments/{id}

(cherry picked from commit 521eed2312f45bef7de28c9c03c04257862a453c)
This commit is contained in:
Loïc Dachary 2023-11-02 15:31:34 +01:00
parent 32c0d8ab9e
commit ff1151c95f
No known key found for this signature in database
GPG key ID: 992D23B392F9E4F2

View file

@ -718,7 +718,17 @@ func deleteIssueComment(ctx *context.APIContext) {
return return
} }
if !ctx.IsSigned || (ctx.Doer.ID != comment.PosterID && !ctx.Repo.IsAdmin()) { if err := comment.LoadIssue(ctx); err != nil {
ctx.Error(http.StatusInternalServerError, "LoadIssue", err)
return
}
if comment.Issue.RepoID != ctx.Repo.Repository.ID {
ctx.Status(http.StatusNotFound)
return
}
if !ctx.IsSigned || (ctx.Doer.ID != comment.PosterID && !ctx.Repo.CanWriteIssuesOrPulls(comment.Issue.IsPull)) {
ctx.Status(http.StatusForbidden) ctx.Status(http.StatusForbidden)
return return
} else if comment.Type != issues_model.CommentTypeComment { } else if comment.Type != issues_model.CommentTypeComment {