Switch channels on quit only if current network is being quit
This commit is contained in:
parent
d5ebdc943c
commit
2044bc88dd
@ -1,9 +1,8 @@
|
||||
"use strict";
|
||||
|
||||
const $ = require("jquery");
|
||||
const socket = require("../socket");
|
||||
const storage = require("../localStorage");
|
||||
const {getActiveWindowComponent} = require("../vue");
|
||||
const {vueApp, getActiveWindowComponent} = require("../vue");
|
||||
const store = require("../store").default;
|
||||
let lastServerHash = null;
|
||||
|
||||
@ -79,11 +78,7 @@ function showSignIn() {
|
||||
window.g_TheLoungeRemoveLoading();
|
||||
}
|
||||
|
||||
$("#footer")
|
||||
.find(".sign-in")
|
||||
.trigger("click", {
|
||||
pushState: false,
|
||||
});
|
||||
vueApp.$router.push("/sign-in");
|
||||
}
|
||||
|
||||
function reloadPage(message) {
|
||||
|
@ -1,6 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
const $ = require("jquery");
|
||||
const socket = require("../socket");
|
||||
const webpush = require("../webpush");
|
||||
const storage = require("../localStorage");
|
||||
@ -56,8 +55,7 @@ socket.on("init", function(data) {
|
||||
// For example, it can be unset if you first open the page after server start
|
||||
vueApp.switchToChannel(store.state.networks[0].channels[0]);
|
||||
} else {
|
||||
// TODO: Use vue router
|
||||
$("#footer .connect").trigger("click");
|
||||
vueApp.$router.push("/connect");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,24 +1,24 @@
|
||||
"use strict";
|
||||
|
||||
const $ = require("jquery");
|
||||
const socket = require("../socket");
|
||||
const sidebar = $("#sidebar");
|
||||
const {vueApp} = require("../vue");
|
||||
const store = require("../store").default;
|
||||
|
||||
socket.on("quit", function(data) {
|
||||
// If we're in a channel, and it's on the network that is being removed,
|
||||
// then open another channel window
|
||||
const isCurrentNetworkBeingRemoved =
|
||||
store.state.activeChannel && store.state.activeChannel.network.uuid === data.network;
|
||||
|
||||
store.commit("removeNetwork", data.network);
|
||||
|
||||
vueApp.$nextTick(() => {
|
||||
const chan = sidebar.find(".chan");
|
||||
if (!isCurrentNetworkBeingRemoved) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (chan.length === 0) {
|
||||
// Open the connect window
|
||||
$("#footer .connect").trigger("click", {
|
||||
pushState: false,
|
||||
});
|
||||
if (store.state.networks.length > 0) {
|
||||
vueApp.switchToChannel(store.state.networks[0].channels[0]);
|
||||
} else {
|
||||
chan.eq(0).trigger("click");
|
||||
vueApp.$router.push("/connect");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user