-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Fixes updateUserGroup cannot clear the description and the default channels #1082
Fixes updateUserGroup cannot clear the description and the default channels #1082
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your PR and sorry for delay🙏
usergroups.go
Outdated
} | ||
|
||
// UpdateUserGroupsOptionChannels change the default channels of the User Group. (default: nil, so it's no-op) | ||
func UpdateUserGroupsOptionChannels(channels *[]string) UpdateUserGroupsOption { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the type of channels should be []string
.
usergroups.go
Outdated
} | ||
|
||
if userGroup.Description != "" { | ||
values["description"] = []string{userGroup.Description} | ||
if !reflect.ValueOf(params.Description).IsNil() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[question]
Why do you use reflect.ValueOf
and reflect.Value.IsNil
?
I think you can use params.Description == nil
in this case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was my misunderstanding. Thanks!
@kanata2 Thanks for your review. Could you please have a look again? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. LGTM!
Fix: #1081
Expected
We can clear the description and the default channels of usergroups by sending empty strings.
Actual
updateUserGroup
ignores empty strings so this never sends empty strings to the server.Examples
The followings are examples using
curl
. ref: https://api.slack.com/methods/usergroups.updateSet Up
Clear the default channels
Clear the description
PR preparation
✅ Ran
make pr-prop
on HEAD (38367d1)Should this be an issue instead
is it a convenience method? (no new functionality, streamlines some use case)exposes a previously private type, const, method, etc.is it application specific (caching, retry logic, rate limiting, etc)is it performance related.API changes
Since API changes have to be maintained they undergo a more detailed review and are more likely to require changes.
no tests, if you're adding to the API include at least a single test of the happy case.dependency changes. updates are okay. adding/removing need justification.Examples of API changes that do not meet guidelines:
N/A