Class: RootController

Inherits:
Dashboard::ProjectsController
  • Object
show all
Includes:
Gitlab::InternalEventsTracking, HomepageData
Defined in:
app/controllers/root_controller.rb

Overview

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.

Constant Summary collapse

CACHE_CONTROL_HEADER =
'no-store'
DASHBOARD_PATHS =
{
  'projects' => ->(context) {
    context.dashboard_projects_path if Feature.enabled?(:personal_homepage, context.current_user)
  },
  'stars' => ->(context) { context.starred_dashboard_projects_path },
  'member_projects' => ->(context) { context.member_dashboard_projects_path },
  'your_activity' => ->(context) { context.activity_dashboard_path },
  'project_activity' => ->(context) { context.activity_dashboard_path(filter: 'projects') },
  'starred_project_activity' => ->(context) { context.activity_dashboard_path(filter: 'starred') },
  'followed_user_activity' => ->(context) { context.activity_dashboard_path(filter: 'followed') },
  'groups' => ->(context) { context.dashboard_groups_path },
  'todos' => ->(context) { context.dashboard_todos_path },
  'issues' => ->(context) { context.issues_dashboard_path(assignee_username: context.current_user.username) },
  'merge_requests' => ->(context) { context.merge_requests_dashboard_path },
  'assigned_merge_requests' => ->(context) {
    context.merge_requests_search_dashboard_path(assignee_username: context.current_user.username)
  },
  'review_merge_requests' => ->(context) {
    context.merge_requests_search_dashboard_path(reviewer_username: context.current_user.username)
  }
}.freeze

Constants included from MergeRequestsHelper

MergeRequestsHelper::DIFF_BATCH_ENDPOINT_PER_PAGE

Instance Method Summary collapse

Methods included from Gitlab::InternalEventsTracking

#track_internal_event

Methods included from MergeRequestsHelper

#allow_collaboration_unavailable_reason, #award_emoji_merge_request_api_path, #can_use_description_composer, #common_merge_request_list_data, #create_mr_button_from_event?, #create_mr_path_from_push_event, #default_merge_request_sort, #diffs_tab_pane_data, #format_mr_branch_names, #group_merge_requests_list_data, #how_merge_modal_data, #identity_verification_alert_data, #merge_params, #merge_path_description, #merge_request_button_hidden?, #merge_request_dashboard_show_drafts?, #merge_request_source_project_for_project, #merge_request_squash_option?, #merge_request_version_path, #mr_change_branches_path, #mr_compare_form_data, #mr_css_classes, #notifications_todos_buttons_enabled?, #project_merge_requests_list_data, #reviewers_label, #show_mr_dashboard_banner?, #sticky_header_data, #summarize_new_merge_request_disabled_reason, #tab_link_for, #target_projects

Methods included from CompareHelper

#create_mr_button?, #create_mr_path, #project_compare_selector_data, #target_projects

Instance Method Details

#indexObject



48
49
50
51
52
53
54
55
56
# File 'app/controllers/root_controller.rb', line 48

def index
  @homepage_app_data = homepage_app_data(current_user)
  if Feature.enabled?(:personal_homepage, current_user)
    track_internal_event('user_views_homepage', user: current_user)
    render('root/index') && return
  end

  super
end