DEV: Fix theme site setting flakiness part 2 #33813
Merged
+5
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In certain scenarios in the specs, we are ending up in
a situation where the default theme has been changed,
but
Theme.user_theme_ids
does not contain that theme'sID, even though it should have the default theme ID. This
means that the default theme isn't selected as the
application_controller
@theme_id
, which is usually usedto get the correct theme site setting values from the cache.
This is happening because we need to clear the Theme cache
every time this changes. Usually this would happen via
theme.set_default!
, but this isn't consistently used,and we don't want to end up in a bad state when people use
SiteSetting.default_theme_id=
directly.This commit fixes the flakiness by moving
Theme.expire_site_cache!
to the main site setting change tracker, this way it's always called
whenever the setting changes.