Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Page tree doesn't switch languages when another site has more than one language. #2956

Closed
dbwinger opened this issue Jul 1, 2024 · 0 comments · Fixed by #2957
Closed

Page tree doesn't switch languages when another site has more than one language. #2956

dbwinger opened this issue Jul 1, 2024 · 0 comments · Fixed by #2957

Comments

@dbwinger
Copy link
Contributor

dbwinger commented Jul 1, 2024

Steps to reproduce

  1. Start the dummy app
  2. Create a second site
  3. Add another language (de) to that site
  4. View pages for the new site and language
  5. Use the site select to switch back to the original default site
  6. Note that the page shown is from the new site/language, not the default site. You can confirm by looking at it's ID when hovering over the page link, or clicking in to edit the page and noting the site/language displayed in its tab.

Expected behavior

When using the site select to switch back to the default site, it should show that site's pages.

Actual behavior

It's stuck on the new site/language's pages. It looks like this is because Alchemy::Admin::CurrentLanguage.load_current_language is using the language ID stored in session, which is only changed by the Languages#switch action, which only happens when switching a language, not when switching sites. My best crack at a fix would be adding a check in Alchemy::Admin::CurrentLanguage.load_current_language for whether session[:alchemy_language_id] is an ID of the site indicated by the site_id parameter, and if not, set it to the site's default language. I'll probably take a stab at this if someone else doesn't get to it before me, but I wanted to report the bug first.

System configuration

  • Alchemy Version: Tested on main and 7.1
  • Rails Version: 7.1.3.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant