Send user to lobby of deleted chan when parting from active chan
Instead of always sending them back to the very first lobby on the app. This fixes a bug introduced in recent layout change but does not bring previous behavior back: When closing active channel, user gets sent to lobby instead of previously visited channel.
This commit is contained in:
parent
4920cfeed9
commit
c9d4513b26
@ -393,29 +393,15 @@ $(function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
socket.on("part", function(data) {
|
socket.on("part", function(data) {
|
||||||
var id = data.chan;
|
var chanMenuItem = sidebar.find(".chan[data-id='" + data.chan + "']");
|
||||||
sidebar.find(".chan[data-id='" + id + "']").remove();
|
|
||||||
$("#chan-" + id).remove();
|
|
||||||
|
|
||||||
var next = null;
|
// When parting from the active channel/query, jump to the network's lobby
|
||||||
var highest = -1;
|
if (chanMenuItem.hasClass("active")) {
|
||||||
chat.find(".chan").each(function() {
|
chanMenuItem.parent(".network").find(".lobby").click();
|
||||||
var self = $(this);
|
|
||||||
var z = parseInt(self.css("z-index"));
|
|
||||||
if (z > highest) {
|
|
||||||
highest = z;
|
|
||||||
next = self;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if (next !== null) {
|
|
||||||
id = next.data("id");
|
|
||||||
sidebar.find("[data-id=" + id + "]").click();
|
|
||||||
} else {
|
|
||||||
sidebar.find(".chan")
|
|
||||||
.eq(0)
|
|
||||||
.click();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
chanMenuItem.remove();
|
||||||
|
$("#chan-" + data.chan).remove();
|
||||||
});
|
});
|
||||||
|
|
||||||
socket.on("quit", function(data) {
|
socket.on("quit", function(data) {
|
||||||
|
Loading…
Reference in New Issue
Block a user