From 426ecf82587306e0279ea74848365d80c9512f6f Mon Sep 17 00:00:00 2001 From: Lucien Kerl Date: Fri, 16 Nov 2018 12:25:20 +0100 Subject: [PATCH 1/2] added the ability to provide an empty array at the EditPullRequests API to remove all labels Signed-off-by: Lucien Kerl --- routers/api/v1/repo/pull.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routers/api/v1/repo/pull.go b/routers/api/v1/repo/pull.go index 83ef886d7d319..8bdd8405d997a 100644 --- a/routers/api/v1/repo/pull.go +++ b/routers/api/v1/repo/pull.go @@ -405,7 +405,7 @@ func EditPullRequest(ctx *context.APIContext, form api.EditPullRequestOption) { } } - if ctx.Repo.IsWriter() && (form.Labels != nil && len(form.Labels) > 0) { + if ctx.Repo.IsWriter() && form.Labels != nil { labels, err := models.GetLabelsInRepoByIDs(ctx.Repo.Repository.ID, form.Labels) if err != nil { ctx.Error(500, "GetLabelsInRepoByIDsError", err) From 6aff5366960fb29c6b26f8c2b25a400e059ac427 Mon Sep 17 00:00:00 2001 From: Lucien Kerl Date: Fri, 30 Nov 2018 13:24:49 +0100 Subject: [PATCH 2/2] Update pull.go --- routers/api/v1/repo/pull.go | 1 - 1 file changed, 1 deletion(-) diff --git a/routers/api/v1/repo/pull.go b/routers/api/v1/repo/pull.go index 5b03bf0889321..9fbadcd076682 100644 --- a/routers/api/v1/repo/pull.go +++ b/routers/api/v1/repo/pull.go @@ -406,7 +406,6 @@ func EditPullRequest(ctx *context.APIContext, form api.EditPullRequestOption) { } if ctx.Repo.CanWrite(models.UnitTypePullRequests) && form.Labels != nil { - labels, err := models.GetLabelsInRepoByIDs(ctx.Repo.Repository.ID, form.Labels) if err != nil { ctx.Error(500, "GetLabelsInRepoByIDsError", err)