Skip to content

Commit 4c98bca

Browse files
committed
improve
1 parent a697e09 commit 4c98bca

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

routers/api/v1/repo/issue_label.go

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,6 @@ func AddIssueLabels(ctx *context.APIContext) {
109109
return
110110
}
111111

112-
// if permission is denied, the prepareForReplaceOrAdd function will return nil, nil, nil
113-
if ctx.Written() {
114-
return
115-
}
116-
117112
if err = issue_service.AddLabels(ctx, issue, ctx.Doer, labels); err != nil {
118113
ctx.Error(http.StatusInternalServerError, "AddLabels", err)
119114
return
@@ -244,10 +239,6 @@ func ReplaceIssueLabels(ctx *context.APIContext) {
244239
return
245240
}
246241

247-
if ctx.Written() {
248-
return
249-
}
250-
251242
if err := issue_service.ReplaceLabels(ctx, issue, ctx.Doer, labels); err != nil {
252243
ctx.Error(http.StatusInternalServerError, "ReplaceLabels", err)
253244
return
@@ -361,7 +352,7 @@ func prepareForReplaceOrAdd(ctx *context.APIContext, form api.IssueLabelsOption)
361352

362353
if !ctx.Repo.CanWriteIssuesOrPulls(issue.IsPull) {
363354
ctx.Status(http.StatusForbidden)
364-
return nil, nil, nil
355+
return nil, nil, fmt.Errorf("permission denied")
365356
}
366357

367358
return issue, labels, err

0 commit comments

Comments
 (0)