Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing Labels via EditPullRequest API #5348

Merged
merged 6 commits into from
Dec 1, 2018

Conversation

lucienkerl
Copy link
Contributor

Because of a comment at the PR #5347 I recognized that it is currently not possible to remove labels.
This PR adds the ability to provide an empty labels array to remove all labels from a PR.

@codecov-io
Copy link

codecov-io commented Nov 16, 2018

Codecov Report

Merging #5348 into master will not change coverage.
The diff coverage is 0%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #5348   +/-   ##
=======================================
  Coverage   37.56%   37.56%           
=======================================
  Files         317      317           
  Lines       46821    46821           
=======================================
  Hits        17590    17590           
  Misses      26732    26732           
  Partials     2499     2499
Impacted Files Coverage Δ
routers/api/v1/repo/pull.go 17.13% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 06ef5b6...e9c4cdf. Read the comment docs.

@bkcsoft bkcsoft added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Nov 16, 2018
@@ -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 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this remove all labels not provided in the request?

Example: I have 5 labels.

  1. Request: Add label 1,4,2
  2. Request: Add label 3

Would this then have 1,2,3,4 or only 3?

Copy link
Contributor Author

@lucienkerl lucienkerl Nov 16, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this will remove all labels not provided in the request.
This would only have the label3 then.
Otherwise you would not be able to delete labels.

@lafriks lafriks added the modifies/api This PR adds API routes or modifies them label Nov 16, 2018
@lafriks lafriks added this to the 1.7.0 milestone Nov 16, 2018
@lafriks
Copy link
Member

lafriks commented Nov 16, 2018

As adding labels by API was just merged and this is change is recent functionality I'm not adding breaking label for this

@bkcsoft bkcsoft added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Nov 16, 2018
@lunny
Copy link
Member

lunny commented Nov 22, 2018

Tests will be better.

@bkcsoft bkcsoft added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Nov 26, 2018
@lunny
Copy link
Member

lunny commented Nov 30, 2018

@lucienkerl file conflicted.

@@ -405,7 +405,8 @@ func EditPullRequest(ctx *context.APIContext, form api.EditPullRequestOption) {
}
}

if ctx.Repo.CanWrite(models.UnitTypePullRequests) && (form.Labels != nil && len(form.Labels) > 0) {
if ctx.Repo.CanWrite(models.UnitTypePullRequests) && form.Labels != nil {

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The blank line is unnecessary.

@techknowlogick techknowlogick merged commit 552014a into go-gitea:master Dec 1, 2018
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. modifies/api This PR adds API routes or modifies them type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants