Merge pull request #2298 from thelounge/xpaw/fix-2293

Do not close sidebar when collapsing networks
This commit is contained in:
Al McKinlay 2018-03-27 17:29:15 +01:00 committed by GitHub
commit a0523b3427
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 5 deletions

View File

@ -335,7 +335,7 @@ $(function() {
$(this).closest(".msg.condensed").toggleClass("closed");
});
const openWindow = function openWindow(e, data) {
const openWindow = function openWindow(e, {keepSidebarOpen, pushState, replaceHistory}) {
const self = $(this);
const target = self.data("target");
@ -372,7 +372,7 @@ $(function() {
utils.toggleNotificationMarkers(false);
}
if ($(window).outerWidth() < utils.mobileViewportPixels) {
if (!keepSidebarOpen && $(window).outerWidth() < utils.mobileViewportPixels) {
slideoutMenu.toggle(false);
}
}
@ -455,7 +455,7 @@ $(function() {
// contains a CSS selector that targets elements which takes the user to a different view
// when clicked. The `popstate` event listener will trigger synthetic click events using that
// selector and thus take the user to a different view/state.
if (data && data.pushState === false) {
if (pushState === false) {
return false;
}
@ -470,7 +470,7 @@ $(function() {
}
if (history && history.pushState) {
if (data && data.replaceHistory && history.replaceState) {
if (replaceHistory && history.replaceState) {
history.replaceState(state, null, target);
} else {
history.pushState(state, null, target);

View File

@ -320,7 +320,9 @@ function collapseNetwork(target) {
const networkuuid = collapseButton.closest(".network").data("uuid");
if (collapseButton.closest(".network").find(".active").length > 0) {
collapseButton.closest(".lobby").click();
collapseButton.closest(".lobby").trigger("click", {
keepSidebarOpen: true,
});
}
collapseButton.closest(".network").toggleClass("collapsed");