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

Only add roles that the member does not have #1072

Merged
merged 3 commits into from
Nov 11, 2020

Conversation

arqunis
Copy link
Member

@arqunis arqunis commented Nov 10, 2020

Should fix #1046.

This is applied in 0.9. The commit will be cherry-picked onto current and next when it is merged.

@arqunis arqunis added fix A solution to an existing bug. model Related to the `model` module. labels Nov 10, 2020
@SadiinsoSnowfall
Copy link
Contributor

I think it would be better to add the roles only if the call to edit_member is successful (as it is done in the add_role method).

@SadiinsoSnowfall
Copy link
Contributor

You could also create a Vec capable of holding all the current roles as well as the new ones.
The current code will cause a re-allocation of the roles vector nearly every time (if one of the new roles is not already contained in self.roles)

@arqunis arqunis merged commit e6fd09b into serenity-rs:v0.9.x Nov 11, 2020
@arqunis arqunis deleted the add_roles_check branch November 11, 2020 22:19
arqunis added a commit to arqunis/serenity that referenced this pull request Nov 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix A solution to an existing bug. model Related to the `model` module.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants