Fix using deleteChannel on private channels

This commit is contained in:
abalabahaha
2016-07-28 04:36:04 +09:00
parent babf550459
commit dc939c48ee
3 changed files with 20 additions and 12 deletions

View File

@@ -1035,8 +1035,12 @@ var InternalClient = (function () {
return this.resolver.resolveChannel(_channel).then(function (channel) {
return _this24.apiRequest("del", _Constants.Endpoints.CHANNEL(channel.id), true).then(function () {
channel.server.channels.remove(channel);
_this24.channels.remove(channel);
if (channel.server) {
channel.server.channels.remove(channel);
_this24.channels.remove(channel);
} else {
_this24.private_channels.remove(channel);
}
});
});
};

View File

@@ -227,7 +227,7 @@ var Server = (function (_Equality) {
channel.members.add(user);
user.voiceChannel = channel;
if (oldChannel.id) {
if (oldChannel.id && channel.id !== oldChannel.id) {
this.client.emit("voiceLeave", oldChannel, user);
this.client.emit("voiceSwitch", oldChannel, channel, user);
}