Skip to content

Commit 89eea64

Browse files
lucienkerljonasfranz
authored andcommitted
added the ability to set labels on the "edit pull request" api (#5347)
Signed-off-by: Lucien Kerl <[email protected]>
1 parent 7278372 commit 89eea64

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

routers/api/v1/repo/pull.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,18 @@ func EditPullRequest(ctx *context.APIContext, form api.EditPullRequestOption) {
405405
}
406406
}
407407

408+
if ctx.Repo.IsWriter() && (form.Labels != nil && len(form.Labels) > 0) {
409+
labels, err := models.GetLabelsInRepoByIDs(ctx.Repo.Repository.ID, form.Labels)
410+
if err != nil {
411+
ctx.Error(500, "GetLabelsInRepoByIDsError", err)
412+
return
413+
}
414+
if err = issue.ReplaceLabels(labels, ctx.User); err != nil {
415+
ctx.Error(500, "ReplaceLabelsError", err)
416+
return
417+
}
418+
}
419+
408420
if err = models.UpdateIssue(issue); err != nil {
409421
ctx.Error(500, "UpdateIssue", err)
410422
return

0 commit comments

Comments
 (0)