summaryrefslogtreecommitdiff
path: root/app/controllers/root_controller.rb
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2015-06-10 03:59:39 -0400
committerRobert Speicher <rspeicher@gmail.com>2015-06-13 17:59:11 -0400
commit94d3c1433df9380ca83f1f35a540074ff0690410 (patch)
tree98da5a0832c587199b848af871e499a8980c4bf7 /app/controllers/root_controller.rb
parent2bc4fd2d047c1c4c4637f045ed3a51d414359c2a (diff)
downloadgitlab-ce-94d3c1433df9380ca83f1f35a540074ff0690410.tar.gz
Add RootController
This controller is now the target for `root_url`. It sub-classes DashboardController so we can render the old default without a redirect if the user hasn't customized their dashboard location.
Diffstat (limited to 'app/controllers/root_controller.rb')
-rw-r--r--app/controllers/root_controller.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/app/controllers/root_controller.rb b/app/controllers/root_controller.rb
new file mode 100644
index 00000000000..7606d2d0fbe
--- /dev/null
+++ b/app/controllers/root_controller.rb
@@ -0,0 +1,18 @@
+# RootController
+#
+# This controller exists solely to handle requests to `root_url`. When a user is
+# logged in and has customized their `dashboard` setting, they will be
+# redirected to their preferred location.
+#
+# For users who haven't customized the setting, we simply delegate to
+# `DashboardController#show`, which is the default.
+class RootController < DashboardController
+ def show
+ case current_user.try(:dashboard)
+ when 'stars'
+ redirect_to starred_dashboard_projects_path
+ else
+ super
+ end
+ end
+end