fix: setPosition taking wrong IDs and edit with position 0 breaking (#1989)

* Fix typo in setPosition

* Same typo in Role

* Fix edit with position breaking when the position was 0

* Eslint

* Revert code but fix the position issue
This commit is contained in:
Frangu Vlad
2017-10-02 16:54:18 +03:00
committed by Crawl
parent fc43736447
commit 743668a10d
2 changed files with 3 additions and 3 deletions

View File

@@ -280,7 +280,7 @@ class GuildChannel extends Channel {
data: {
name: (data.name || this.name).trim(),
topic: data.topic,
position: data.position || this.rawPosition,
position: typeof data.position === 'number' ? data.position : this.rawPosition,
bitrate: data.bitrate || (this.bitrate ? this.bitrate * 1000 : undefined),
user_limit: data.userLimit != null ? data.userLimit : this.userLimit, // eslint-disable-line eqeqeq
parent_id: data.parentID,
@@ -357,7 +357,7 @@ class GuildChannel extends Channel {
this.guild._sortedChannels(this), this.client.api.guilds(this.guild.id).channels, reason)
.then(updatedChannels => {
this.client.actions.GuildChannelsPositionUpdate.handle({
guild_id: this.id,
guild_id: this.guild.id,
channels: updatedChannels,
});
return this;

View File

@@ -279,7 +279,7 @@ class Role extends Base {
this.guild._sortedRoles(), this.client.api.guilds(this.guild.id).roles, reason)
.then(updatedRoles => {
this.client.actions.GuildRolesPositionUpdate.handle({
guild_id: this.id,
guild_id: this.guild.id,
channels: updatedRoles,
});
return this;