summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2015-06-12 20:53:58 -0400
committerRobert Speicher <rspeicher@gmail.com>2015-06-16 12:52:47 -0400
commitf323b8c4e5f43597d126dbed2fa27455a8c2e416 (patch)
tree486e6a610c0ffc2bcfe66ea5e60434182605e6f4
parent7cff7d6fce29511230314123a9de1d78b048fa29 (diff)
downloadgitlab-ce-f323b8c4e5f43597d126dbed2fa27455a8c2e416.tar.gz
Refactor RootController
cherry-picked
-rw-r--r--app/controllers/root_controller.rb14
1 files changed, 12 insertions, 2 deletions
diff --git a/app/controllers/root_controller.rb b/app/controllers/root_controller.rb
index 7606d2d0fbe..fdfe00dc135 100644
--- a/app/controllers/root_controller.rb
+++ b/app/controllers/root_controller.rb
@@ -7,12 +7,22 @@
# For users who haven't customized the setting, we simply delegate to
# `DashboardController#show`, which is the default.
class RootController < DashboardController
+ before_action :redirect_to_custom_dashboard, only: [:show]
+
def show
- case current_user.try(:dashboard)
+ super
+ end
+
+ private
+
+ def redirect_to_custom_dashboard
+ return unless current_user
+
+ case current_user.dashboard
when 'stars'
redirect_to starred_dashboard_projects_path
else
- super
+ return
end
end
end