Skip to content

Commit fdf7965

Browse files
committed
ctx.Repo.CanWrite has ctx.User.IsAdmin in It
1 parent 0c10267 commit fdf7965

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

routers/api/v1/repo/issue_reaction.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ func GetIssueCommentReactions(ctx *context.APIContext) {
5555
return
5656
}
5757

58-
if !ctx.Repo.CanRead(models.UnitTypeIssues) && !ctx.User.IsAdmin {
58+
if !ctx.Repo.CanRead(models.UnitTypeIssues) {
5959
ctx.Error(http.StatusForbidden, "GetIssueCommentReactions", errors.New("no permission to get reactions"))
6060
return
6161
}
@@ -179,7 +179,7 @@ func changeIssueCommentReaction(ctx *context.APIContext, form api.EditReactionOp
179179
ctx.Error(http.StatusInternalServerError, "comment.LoadIssue() failed", err)
180180
}
181181

182-
if comment.Issue.IsLocked && !ctx.Repo.CanWrite(models.UnitTypeIssues) && !ctx.User.IsAdmin {
182+
if comment.Issue.IsLocked && !ctx.Repo.CanWrite(models.UnitTypeIssues) {
183183
ctx.Error(http.StatusForbidden, "ChangeIssueCommentReaction", errors.New("no permission to change reaction"))
184184
return
185185
}
@@ -261,7 +261,7 @@ func GetIssueReactions(ctx *context.APIContext) {
261261
return
262262
}
263263

264-
if !ctx.Repo.CanRead(models.UnitTypeIssues) && !ctx.User.IsAdmin {
264+
if !ctx.Repo.CanRead(models.UnitTypeIssues) {
265265
ctx.Error(http.StatusForbidden, "GetIssueReactions", errors.New("no permission to get reactions"))
266266
return
267267
}
@@ -380,7 +380,7 @@ func changeIssueReaction(ctx *context.APIContext, form api.EditReactionOption, i
380380
return
381381
}
382382

383-
if issue.IsLocked && !ctx.Repo.CanWrite(models.UnitTypeIssues) && !ctx.User.IsAdmin {
383+
if issue.IsLocked && !ctx.Repo.CanWrite(models.UnitTypeIssues) {
384384
ctx.Error(http.StatusForbidden, "ChangeIssueCommentReaction", errors.New("no permission to change reaction"))
385385
return
386386
}

0 commit comments

Comments
 (0)