discourse/lib/homepage_helper.rb
Penar Musaraj 33de5abb6e
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.
2024-06-20 11:33:46 -04:00

10 lines
275 B
Ruby

# frozen_string_literal: true
class HomepageHelper
def self.resolve(theme_id = nil, current_user = nil)
return "custom" if ThemeModifierHelper.new(theme_ids: theme_id).custom_homepage
current_user ? SiteSetting.homepage : SiteSetting.anonymous_homepage
end
end