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

Cannot use UpdateIssue to remove all issue assignees #427

Closed
lily-mara opened this issue Jun 28, 2018 · 6 comments · Fixed by #1294
Closed

Cannot use UpdateIssue to remove all issue assignees #427

lily-mara opened this issue Jun 28, 2018 · 6 comments · Fixed by #1294
Labels

Comments

@lily-mara
Copy link
Contributor

Since UpdateIssueOptions defines AssigneeIDs as a []int, and marks it as omitempty, it is omitted from the JSON request if an empty array is passed into it. The Gitlab API docs describe the field as follows:

The ID of the user(s) to assign the issue to. Set to 0 or provide an empty value to unassign all assignees.

Based on the current definition of UpdateIssueOptions, it is impossible to unassign all assignees. You cannot remove the omitempty item, or every call to UpdateIssue will remove all issue assignees. if you want to support this, I think there needs to be a separate method.

@svanharmelen
Copy link
Member

Thanks for the report @natemara! Did you also try to give it a []int{0} as value? No idea, but maybe worth checking...

@svanharmelen
Copy link
Member

Hi @natemara! Did you have a chance to test this, and so is this still an issue?

@0xmohit
Copy link
Contributor

0xmohit commented Oct 22, 2018

Specifying []int{0} as value does remove the assignee.

@svanharmelen
Copy link
Member

Then I think the only way to solve this is by making this a *[]int, but I must admit that feels a bit nasty.

@no0by5
Copy link

no0by5 commented Aug 5, 2019

The same problem applys to labels. You can't remove them by setting it to an emtpy slice, but if you use []string{""} it works.

@svanharmelen
Copy link
Member

PR #1294 is a nasty breaking change, but it does fix this issue...

svanharmelen added a commit that referenced this issue Jan 4, 2022
pdecat pushed a commit to pdecat/go-gitlab that referenced this issue Jan 23, 2022
gravis pushed a commit to gravis/go-gitlab that referenced this issue Sep 1, 2022
gravis pushed a commit to gravis/go-gitlab that referenced this issue Sep 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants