mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 09:42:07 +08:00
d81fc1448b
This commit will allow plugin developers to enable/disable the custom homepage. Usage: ```ruby register_modifier(:custom_homepage_enabled) do |enabled, args| true end ``` Args might contain request and/or current_user.
20 lines
504 B
Ruby
20 lines
504 B
Ruby
# frozen_string_literal: true
|
|
|
|
class HomepageHelper
|
|
def self.resolve(request = nil, current_user = nil)
|
|
return "custom" if ThemeModifierHelper.new(request: request).custom_homepage
|
|
|
|
enabled = false
|
|
enabled =
|
|
DiscoursePluginRegistry.apply_modifier(
|
|
:custom_homepage_enabled,
|
|
enabled,
|
|
request: request,
|
|
current_user: current_user,
|
|
)
|
|
return "custom" if enabled
|
|
|
|
current_user ? SiteSetting.homepage : SiteSetting.anonymous_homepage
|
|
end
|
|
end
|