mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 18:51:08 +08:00
DEV: Extract theme resolution to a helper (#27426)
This ensures that the theme id is resolved as early as possible in the request cycle. This is necessary for the custom homepage to skip preloading the wrong data.
This commit is contained in:
@ -9,7 +9,11 @@ class HomePageConstraint
|
||||
return @filter == "finish_installation" if SiteSetting.has_login_hint?
|
||||
|
||||
current_user = CurrentUser.lookup_from_env(request.env)
|
||||
homepage = current_user&.user_option&.homepage || HomepageHelper.resolve(request, current_user)
|
||||
|
||||
# ensures we resolve the theme id as early as possible
|
||||
theme_id = ThemeResolver.resolve_theme_id(request, Guardian.new(current_user), current_user)
|
||||
|
||||
homepage = current_user&.user_option&.homepage || HomepageHelper.resolve(theme_id, current_user)
|
||||
homepage == @filter
|
||||
rescue Discourse::InvalidAccess, Discourse::ReadOnly
|
||||
false
|
||||
|
Reference in New Issue
Block a user