From 99c8e1c04a85a39d39c2898cde3e493128c89c32 Mon Sep 17 00:00:00 2001 From: PolarizedIons Date: Mon, 2 Oct 2017 13:38:34 +0200 Subject: [PATCH] Remove channel containers from DOM after quitting network --- client/js/socket-events/quit.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/client/js/socket-events/quit.js b/client/js/socket-events/quit.js index 8caa26bc..37b7df4c 100644 --- a/client/js/socket-events/quit.js +++ b/client/js/socket-events/quit.js @@ -1,12 +1,20 @@ "use strict"; const $ = require("jquery"); +const chat = $("#chat"); const socket = require("../socket"); const sidebar = $("#sidebar"); socket.on("quit", function(data) { const id = data.network; - sidebar.find("#network-" + id).remove(); + const network = sidebar.find("#network-" + id); + + network.children(".chan").each(function() { + // this = child + chat.find($(this).data("target")).remove(); + }); + + network.remove(); const chan = sidebar.find(".chan") .eq(0)