FEATURE: Allow the user to select a custom home page (#5268)

* Add user_home configuration option

* Use the new user_home preference to actually show the right home page

* Fix trailing whitespace

* Update user_option_serializer.rb

* Fix JavaScript default homepage tests

* Use an object instead of a giant switch

* Remove trailing whitespace

* Make the default `user_home` set to `null` instead of `0`

* Rename user_home to homepage_id
This commit is contained in:
Michael Howell
2017-11-09 12:45:19 -07:00
committed by Sam
parent 162932114e
commit 38b8d68c68
14 changed files with 90 additions and 4 deletions

View File

@ -7,7 +7,7 @@ class HomePageConstraint
return @filter == 'finish_installation' if SiteSetting.has_login_hint?
provider = Discourse.current_user_provider.new(request.env)
homepage = provider.current_user ? SiteSetting.homepage : SiteSetting.anonymous_homepage
homepage = provider&.current_user&.user_option&.homepage || SiteSetting.anonymous_homepage
homepage == @filter
rescue Discourse::InvalidAccess
false