Template
1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo synced 2024-11-27 20:26:09 +01:00

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 939a66e25c
commit 0b0b506b74
No known key found for this signature in database
GPG key ID: 992D23B392F9E4F2

View file

@ -693,7 +693,17 @@ func deleteIssueComment(ctx *context.APIContext) {
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)
return
} else if comment.Type != issues_model.CommentTypeComment {