From 6e5b6743380ba7d76b3b2ae9da298959a3433959 Mon Sep 17 00:00:00 2001 From: sekwah41 Date: Fri, 13 Apr 2018 13:03:18 +0100 Subject: [PATCH] Fixed updateChannel being too protective (#2460) If I am not mistaken the only way atm to remove a channels parent atm is to do this to get the null value through the code. channel.client.rest.methods.updateChannel({id:channel.id, name:channel.name, topic:channel.topic,position:channel.position, bitrate:channel.bitrate,userLimit:channel.userLimit,parent:{id:null}}, {}); This fixes the method allowing channel.setParent(null); to work --- src/client/rest/RESTMethods.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/rest/RESTMethods.js b/src/client/rest/RESTMethods.js index f0fd85cf0..06438f958 100644 --- a/src/client/rest/RESTMethods.js +++ b/src/client/rest/RESTMethods.js @@ -337,7 +337,7 @@ class RESTMethods { data.position = _data.position || channel.position; data.bitrate = _data.bitrate || (channel.bitrate ? channel.bitrate * 1000 : undefined); data.user_limit = typeof _data.userLimit !== 'undefined' ? _data.userLimit : channel.userLimit; - data.parent_id = _data.parent || (channel.parent ? channel.parent.id : undefined); + data.parent_id = _data.parent === null ? null : _data.parent || (channel.parent ? channel.parent.id : undefined); return this.rest.makeRequest('patch', Endpoints.Channel(channel), true, data, undefined, reason).then(newData => this.client.actions.ChannelUpdate.handle(newData).updated );