add current_user_provider so people can override current_user bevior cleanly, see

http://meta.discourse.org/t/amending-current-user-logic-in-discourse/10278
This commit is contained in:
Sam
2013-10-09 15:10:37 +11:00
parent 8e6ae0e278
commit 7993845bfa
15 changed files with 178 additions and 84 deletions

View File

@ -4,7 +4,8 @@ class HomePageConstraint
end
def matches?(request)
homepage = request.session[:current_user_id].present? ? SiteSetting.homepage : SiteSetting.anonymous_homepage
provider = Discourse.current_user_provider.new(request.env)
homepage = provider.current_user ? SiteSetting.homepage : SiteSetting.anonymous_homepage
homepage == @filter
end
end
end