From d1c2f0df7284af7c555a493f59c5b6357067ded8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Astori?= Date: Sat, 23 Dec 2017 20:46:43 -0500 Subject: [PATCH] Display the correct window on page reload This commit packs 2 fixes: - Reloading the page while viewing the settings or help window would now send you to a channel window. This was broken when fixing an issue with the "Join a channel..." form - Reloading the page while viewing the changelog would also send you to a channel window. This is because, on reload, the click emitted was restricted to sidebar and footer, while it had to be emitted from the help page. It is yet another aspect of our wonky window management and hopefully we can make this much more robust with a better overall solution. --- client/js/socket-events/init.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client/js/socket-events/init.js b/client/js/socket-events/init.js index bc9079d8..621984cd 100644 --- a/client/js/socket-events/init.js +++ b/client/js/socket-events/init.js @@ -64,7 +64,8 @@ function openCorrectChannel(clientActive, serverActive) { // Open window provided in location.hash if (target.length === 0 && window.location.hash) { - target = $("#footer, #sidebar").find(`.chan[data-target="${escape(window.location.hash)}"]`); + target = $("#footer, #sidebar, #help") + .find(`[data-target="${escape(window.location.hash)}"]`); } // Open last active channel according to the server