From b6237e86a665ffc78e5b2dad8437a1fb9b1bcbbf Mon Sep 17 00:00:00 2001 From: Fabien Quatravaux Date: Sat, 25 Apr 2020 13:25:24 +0200 Subject: [PATCH] [fix] Take care of subchannels --- app/index.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/index.js b/app/index.js index 4d7f4f0..0e8bafa 100644 --- a/app/index.js +++ b/app/index.js @@ -784,9 +784,18 @@ class GlobalBindings { this.requestMove = (user, channel) => { if (this.connected()) { user.model.setChannel(channel.model) + + // get full channel path + let path = channel.name() + let parent = channel.parent() + while( parent.name && parent.name() != 'Root' ){ + path = parent.name() + '/' + path + parent = parent.parent() + } // reflect this change in URL let currentUrl = url.parse(document.location.href, true) - currentUrl.query.channelName = channel.name() + currentUrl.query.channelName = path + // delete search param so that query one can be taken into account delete currentUrl.search window.history.pushState(null, channel.name(), url.format(currentUrl)) }