From 6c50fe72b99b58524e2cabdda449e3a2bdd32f65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Astori?= Date: Sat, 23 Dec 2017 03:00:16 -0500 Subject: [PATCH] Fix join channel UI opening by itself Without this, `target` was matching all of the lobby link, the "Join a channel..." button, and the join form submit button. This change restricts to the first one. --- client/js/socket-events/init.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/client/js/socket-events/init.js b/client/js/socket-events/init.js index 7dae4c94..bc9079d8 100644 --- a/client/js/socket-events/init.js +++ b/client/js/socket-events/init.js @@ -59,17 +59,17 @@ function openCorrectChannel(clientActive, serverActive) { // Open last active channel if (clientActive > 0) { - target = sidebar.find("[data-id='" + clientActive + "']"); + target = sidebar.find(`.chan[data-id="${clientActive}"]`); } // Open window provided in location.hash if (target.length === 0 && window.location.hash) { - target = $("#footer, #sidebar").find("[data-target='" + escape(window.location.hash) + "']"); + target = $("#footer, #sidebar").find(`.chan[data-target="${escape(window.location.hash)}"]`); } // Open last active channel according to the server if (serverActive > 0 && target.length === 0) { - target = sidebar.find("[data-id='" + serverActive + "']"); + target = sidebar.find(`.chan[data-id="${serverActive}"]`); } // Open first available channel