mirror of
https://github.com/discourse/discourse.git
synced 2025-02-24 05:31:27 +08:00
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:
parent
4e2a982e91
commit
8ca2c14874
@ -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;
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ class MainSidebarPanel {
|
||||
}
|
||||
|
||||
get switchButtonDefaultUrl() {
|
||||
return "/";
|
||||
return this?.lastKnownURL || "/";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user