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)