aboutsummaryrefslogtreecommitdiffstats
path: root/routers/api
diff options
context:
space:
mode:
authorLucien Kerl <lucien@kerl.io>2018-11-16 12:12:44 +0100
committerJonas Franz <info@jonasfranz.software>2018-11-16 12:12:44 +0100
commit89eea64e101b58d9585b2a186ff6d527c17e49e4 (patch)
treeb0297032741fb90238ae9b2ae34e669e5ba8f445 /routers/api
parent7278372388d5482cdedf1d247999f38569479553 (diff)
downloadgitea-89eea64e101b58d9585b2a186ff6d527c17e49e4.tar.gz
gitea-89eea64e101b58d9585b2a186ff6d527c17e49e4.zip
added the ability to set labels on the "edit pull request" api (#5347)
Signed-off-by: Lucien Kerl <lucien.kerl@wuerth-it.com>
Diffstat (limited to 'routers/api')
-rw-r--r--routers/api/v1/repo/pull.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/routers/api/v1/repo/pull.go b/routers/api/v1/repo/pull.go
index 5ce6f868bc..83ef886d7d 100644
--- a/routers/api/v1/repo/pull.go
+++ b/routers/api/v1/repo/pull.go
@@ -405,6 +405,18 @@ func EditPullRequest(ctx *context.APIContext, form api.EditPullRequestOption) {
}
}
+ if ctx.Repo.IsWriter() && (form.Labels != nil && len(form.Labels) > 0) {
+ labels, err := models.GetLabelsInRepoByIDs(ctx.Repo.Repository.ID, form.Labels)
+ if err != nil {
+ ctx.Error(500, "GetLabelsInRepoByIDsError", err)
+ return
+ }
+ if err = issue.ReplaceLabels(labels, ctx.User); err != nil {
+ ctx.Error(500, "ReplaceLabelsError", err)
+ return
+ }
+ }
+
if err = models.UpdateIssue(issue); err != nil {
ctx.Error(500, "UpdateIssue", err)
return