summaryrefslogtreecommitdiff
path: root/app/controllers/root_controller.rb
blob: fdfe00dc13503fa2d11703b6c0a0d7df19581223 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# 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
  before_action :redirect_to_custom_dashboard, only: [:show]

  def show
    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
      return
    end
  end
end