mirror of
https://github.com/thelounge/thelounge
synced 2024-11-14 16:27:22 +00:00
[Squash me] Fix bug refusing to switch channel when clicking back after closing image viewer
This commit is contained in:
parent
b33ea0f567
commit
a921d7bf04
2 changed files with 6 additions and 5 deletions
|
@ -331,7 +331,7 @@ $(function() {
|
|||
const state = {};
|
||||
|
||||
if (self.hasClass("chan")) {
|
||||
state.clickTarget = `.chan[data-id="${self.data("id")}"]`;
|
||||
state.clickTarget = `#sidebar .chan[data-id="${self.data("id")}"]`;
|
||||
} else {
|
||||
state.clickTarget = `#footer button[data-target="${target}"]`;
|
||||
}
|
||||
|
@ -812,9 +812,7 @@ $(function() {
|
|||
if (clickTarget) {
|
||||
// This will be true when click target corresponds to opening a thumbnail,
|
||||
// browsing to the previous/next thumbnail, or closing the image viewer.
|
||||
const imageViewerRelated =
|
||||
clickTarget === "#image-viewer" ||
|
||||
clickTarget.includes(".toggle-thumbnail");
|
||||
const imageViewerRelated = clickTarget.includes(".toggle-thumbnail");
|
||||
|
||||
// If the click target is not related to the image viewer but the viewer
|
||||
// is currently opened, we need to close it.
|
||||
|
|
|
@ -202,6 +202,9 @@ function closeImageViewer({pushState = true} = {}) {
|
|||
|
||||
// History management
|
||||
if (pushState) {
|
||||
history.pushState({clickTarget: "#image-viewer"}, null, null);
|
||||
const clickTarget =
|
||||
"#sidebar " +
|
||||
`.chan[data-id="${$("#sidebar .chan.active").data("id")}"]`;
|
||||
history.pushState({clickTarget}, null, null);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue