mirror of
https://github.com/thelounge/thelounge
synced 2024-11-23 20:43:08 +00:00
Merge pull request #1549 from thelounge/xpaw/fix-default-chan
Fix opening first channel on server start
This commit is contained in:
commit
e165d51e60
3 changed files with 11 additions and 6 deletions
|
@ -50,7 +50,7 @@ socket.on("init", function(data) {
|
|||
});
|
||||
|
||||
function openCorrectChannel(clientActive, serverActive) {
|
||||
let target;
|
||||
let target = $();
|
||||
|
||||
// Open last active channel
|
||||
if (clientActive > 0) {
|
||||
|
@ -58,17 +58,22 @@ function openCorrectChannel(clientActive, serverActive) {
|
|||
}
|
||||
|
||||
// Open window provided in location.hash
|
||||
if (!target && window.location.hash) {
|
||||
if (target.length === 0 && window.location.hash) {
|
||||
target = $("#footer, #sidebar").find("[data-target='" + escape(window.location.hash) + "']");
|
||||
}
|
||||
|
||||
// Open last active channel according to the server
|
||||
if (!target) {
|
||||
if (serverActive > 0 && target.length === 0) {
|
||||
target = sidebar.find("[data-id='" + serverActive + "']");
|
||||
}
|
||||
|
||||
// Open first available channel
|
||||
if (target.length === 0) {
|
||||
target = sidebar.find(".chan").first();
|
||||
}
|
||||
|
||||
// If target channel is found, open it
|
||||
if (target) {
|
||||
if (target.length > 0) {
|
||||
target.trigger("click", {
|
||||
replaceHistory: true
|
||||
});
|
||||
|
|
|
@ -14,7 +14,7 @@ Chan.Type = {
|
|||
SPECIAL: "special",
|
||||
};
|
||||
|
||||
var id = 0;
|
||||
let id = 1;
|
||||
|
||||
function Chan(attr) {
|
||||
_.defaults(this, attr, {
|
||||
|
|
|
@ -5,7 +5,7 @@ var Chan = require("./chan");
|
|||
|
||||
module.exports = Network;
|
||||
|
||||
var id = 0;
|
||||
let id = 1;
|
||||
|
||||
function Network(attr) {
|
||||
_.defaults(this, attr, {
|
||||
|
|
Loading…
Reference in a new issue