Skip to content

Fix exception in admin when current language is deleted#3790

Merged
tvdeyen merged 1 commit intoAlchemyCMS:mainfrom
halfbyte:fix-exception-after-language-deletion
Mar 26, 2026
Merged

Fix exception in admin when current language is deleted#3790
tvdeyen merged 1 commit intoAlchemyCMS:mainfrom
halfbyte:fix-exception-after-language-deletion

Conversation

@halfbyte
Copy link
Contributor

What is this pull request for?

This fixes a situation where the session contains a language id for a language that no longer exists because it has been deleted.

Notable changes (remove if none)

This commit fixes this in two ways:

  • when deleting the language, it is removed from the session if the language is identical
  • when trying to get the language from the session id, the lookup code now falls back to the default language if it can't be found. This is meant to fix the scenario where a different user deletes the language instead of the user with the language id in the session

I believe both fixes are useful.

I've tried to come up with meaningful tests but I am somewhat unfamiliar with the codebase so feel free to suggest extra things.

A backport to Alchemy 7 would be appreciated if possible, as it will probably still take us a while to get to 8.

Checklist

  • I have followed Pull Request guidelines
  • I have added a detailed description into each commit message
  • I have added tests to cover this change

This fixes a situation where the session contains a language id for a
language that no longer exists because it has been deleted.

This commit fixes this in two ways:

- when deleting the language, it is removed from the session if the
language is identical
- when trying to get the language from the session id, the lookup code
now falls back to the default language if it can't be found. This is
meant to fix the scenario where a different user deletes the language
instead of the user with the language id in the session

I believe both fixes are useful.

I've tried to come up with meaningful tests but I am somewhat unfamiliar
with the codebase so feel free to suggest extra things.

A backport to Alchemy 7 would be appreciated if possible, as it will
probably still take us a while to get to 8.
@halfbyte halfbyte requested a review from a team as a code owner March 26, 2026 14:10
@codecov
Copy link

codecov bot commented Mar 26, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.48%. Comparing base (ab3eb3f) to head (380d62c).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3790   +/-   ##
=======================================
  Coverage   97.48%   97.48%           
=======================================
  Files         320      320           
  Lines        8494     8497    +3     
=======================================
+ Hits         8280     8283    +3     
  Misses        214      214           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@tvdeyen tvdeyen added backport-to-7.4-stable Needs to be backported to 7.4-stable backport-to-8.0-stable Needs to be backported to 8.0-stable backport-to-8.1-stable Needs to be backported to 8.1-stable labels Mar 26, 2026
Copy link
Member

@tvdeyen tvdeyen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Very much appreciated. Back porting to 7.4 if this helps.

@tvdeyen tvdeyen merged commit d7564d4 into AlchemyCMS:main Mar 26, 2026
31 checks passed
@alchemycms-bot
Copy link

💚 All backports created successfully

Status Branch Result
7.4-stable
8.0-stable
8.1-stable

Questions ?

Please refer to the Backport tool documentation and see the Github Action logs for details

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-to-7.4-stable Needs to be backported to 7.4-stable backport-to-8.0-stable Needs to be backported to 8.0-stable backport-to-8.1-stable Needs to be backported to 8.1-stable

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants