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

Correctly mapping overwrites when creating a channel and renamed all relevant property names as of #1562 #1570

Merged
merged 4 commits into from
Jun 16, 2017

Conversation

SpaceEEC
Copy link
Member

@SpaceEEC SpaceEEC commented Jun 7, 2017

Please describe the changes this PR makes and why it should be merged:

Since those two properties were renamed PermissionOverwrites require mapping before sending them to discord.

Changing the names of the properties back would be a better solution IMO.

Also passing now the overwrites as correct parameter when cloning a channel.

Edit:

Changed all .deny and .allow for permission related methods in GuildChannel to their new property names.
Related to #1595's problem with .joinable being incorrectly true.

Semantic versioning classification:

  • This PR changes the library's interface (methods or parameters added)
    • This PR includes breaking changes (methods removed or renamed, parameters moved or removed)
  • This PR only includes non-code changes, like changes to documentation, README, etc.

@SpaceEEC SpaceEEC changed the title Mapping PermissionOverwrites to correct it's "discord" properties when sending them Mapping PermissionOverwrites to it's correct "discord" properties when sending them Jun 7, 2017
Copy link
Contributor

@PgBiel PgBiel left a comment

Choose a reason for hiding this comment

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

Woops!

if (overwrites instanceof Collection) overwrites = overwrites.array();
if (overwrites instanceof Collection || overwrites instanceof Array) {
overwrites = overwrites.map(overwrite => ({
allow: overwrite.allow || overwrite._allowed,
Copy link
Contributor

Choose a reason for hiding this comment

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

.allowed

if (overwrites instanceof Collection || overwrites instanceof Array) {
overwrites = overwrites.map(overwrite => ({
allow: overwrite.allow || overwrite._allowed,
deny: overwrite.deny || overwrite._denied,
Copy link
Contributor

Choose a reason for hiding this comment

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

.denied

@SpaceEEC SpaceEEC changed the title Mapping PermissionOverwrites to it's correct "discord" properties when sending them Correctly mapping overwrites when creating a channel and renamed all relevant property names as of #1562 Jun 15, 2017
permissions &= ~overwrites.everyone.deny;
permissions |= overwrites.everyone.allow;
permissions &= ~overwrites.everyone._denied;
permissions |= overwrites.everyone._alloweded;
Copy link
Contributor

Choose a reason for hiding this comment

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

_alloweded => _allowed

Copy link
Member Author

Choose a reason for hiding this comment

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

nice copy paste :^)

@iCrawl iCrawl merged commit 00eebd3 into discordjs:master Jun 16, 2017
@SpaceEEC SpaceEEC deleted the permissionOverwrites branch June 16, 2017 10:52
Ratismal pushed a commit to Ratismal/discord.js that referenced this pull request Jul 5, 2017
…relevant property names as of discordjs#1562 (discordjs#1570)

* using correct properties to apply permissionOverwrites

and fixed `GuildChannel#clone`

* also arrays should be mapped and correct properties taking priority

* changed .deny and .allow to .denied and .allowed respectively

* whoops
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants