FIX: switch panel back to forum last known url (#31092)

Previously the return to forum link would automatically take you to the
forum homepage, however this was not intended functionality. We should
attempt to take the user to their last viewed forum page.

This change fixes a bug in how we determined what the destination link
should be.

Internal ref: /t/110508
This commit is contained in:
David Battersby 2025-01-31 17:18:24 +04:00 committed by GitHub
parent 4e2a982e91
commit 8ca2c14874
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 3 additions and 3 deletions

View File

@ -16,7 +16,7 @@ export default class SwitchPanelButtons extends Component {
this.isSwitching = true;
this.sidebarState.currentPanel.lastKnownURL = this.router.currentURL;
const destination = panel?.switchButtonDefaultUrl || panel?.lastKnownURL;
const destination = panel?.switchButtonDefaultUrl;
if (!destination) {
return;
}

View File

@ -21,7 +21,7 @@ class MainSidebarPanel {
}
get switchButtonDefaultUrl() {
return "/";
return this?.lastKnownURL || "/";
}
}

View File

@ -221,7 +221,7 @@ RSpec.describe "Separate sidebar mode", type: :system do
expect(channel_browse_page.component).to be_present
sidebar_component.switch_to_main
expect(page).to have_current_path("/discuss/")
expect(page).to have_current_path("/discuss/about")
end
end
end