]> source.dussan.org Git - gitea.git/commitdiff
Issue comment reactions should also check pull type (#13349)
authorzeripath <art27@cantab.net>
Thu, 29 Oct 2020 12:48:07 +0000 (12:48 +0000)
committerGitHub <noreply@github.com>
Thu, 29 Oct 2020 12:48:07 +0000 (20:48 +0800)
* Migrating reactions is just not that important

A failure during migrating reactions should not cause failure of
migration.

Signed-off-by: Andrew Thornton <art27@cantab.net>
* When checking issue reactions check the correct permission

Signed-off-by: Andrew Thornton <art27@cantab.net>
* And there is another one ...

Signed-off-by: Andrew Thornton <art27@cantab.net>
routers/api/v1/repo/issue_reaction.go

index 5c983b0fc5a41abfad25c21f50a8c14f3dd97231..dfe618480fa404eb1b98c9e19f5cea405581d752 100644 (file)
@@ -57,7 +57,11 @@ func GetIssueCommentReactions(ctx *context.APIContext) {
                return
        }
 
-       if !ctx.Repo.CanRead(models.UnitTypeIssues) {
+       if err := comment.LoadIssue(); err != nil {
+               ctx.Error(http.StatusInternalServerError, "comment.LoadIssue", err)
+       }
+
+       if !ctx.Repo.CanReadIssuesOrPulls(comment.Issue.IsPull) {
                ctx.Error(http.StatusForbidden, "GetIssueCommentReactions", errors.New("no permission to get reactions"))
                return
        }