Module: Users::CalloutsHelper

Defined in:
app/helpers/users/callouts_helper.rb

Constant Summary collapse

GKE_CLUSTER_INTEGRATION =
'gke_cluster_integration'
GCP_SIGNUP_OFFER =
'gcp_signup_offer'
SUGGEST_POPOVER_DISMISSED =
'suggest_popover_dismissed'
TABS_POSITION_HIGHLIGHT =
'tabs_position_highlight'
FEATURE_FLAGS_NEW_VERSION =
'feature_flags_new_version'
REGISTRATION_ENABLED_CALLOUT =
'registration_enabled_callout'
UNFINISHED_TAG_CLEANUP_CALLOUT =
'unfinished_tag_cleanup_callout'
SECURITY_NEWSLETTER_CALLOUT =
'security_newsletter_callout'
MERGE_REQUEST_SETTINGS_MOVED_CALLOUT =
'merge_request_settings_moved_callout'
PAGES_MOVED_CALLOUT =
'pages_moved_callout'
REGISTRATION_ENABLED_CALLOUT_ALLOWED_CONTROLLER_PATHS =
[/^root/, /^dashboard\S*/, /^admin\S*/].freeze
WEB_HOOK_DISABLED =
'web_hook_disabled'
BRANCH_RULES_INFO_CALLOUT =
'branch_rules_info_callout'
NEW_NAVIGATION_CALLOUT =
'new_navigation_callout'

Instance Method Summary collapse

Instance Method Details

#dismiss_two_factor_auth_recovery_settings_checkObject



56
57
# File 'app/helpers/users/callouts_helper.rb', line 56

def dismiss_two_factor_auth_recovery_settings_check
end

#gitlab_com_user_created_after_new_nav_rollout?Boolean

Returns:

  • (Boolean)


90
91
92
93
94
# File 'app/helpers/users/callouts_helper.rb', line 90

def gitlab_com_user_created_after_new_nav_rollout?
  return true unless current_user

  Gitlab.com? && current_user.created_at >= Date.new(2023, 6, 2)
end

#render_dashboard_ultimate_trial(user) ⇒ Object



30
31
# File 'app/helpers/users/callouts_helper.rb', line 30

def render_dashboard_ultimate_trial(user)
end

#render_two_factor_auth_recovery_settings_checkObject



33
34
# File 'app/helpers/users/callouts_helper.rb', line 33

def render_two_factor_auth_recovery_settings_check
end

#show_branch_rules_info?Boolean

Returns:

  • (Boolean)


78
79
80
# File 'app/helpers/users/callouts_helper.rb', line 78

def show_branch_rules_info?
  !user_dismissed?(BRANCH_RULES_INFO_CALLOUT)
end

#show_feature_flags_new_version?Boolean

Returns:

  • (Boolean)


40
41
42
# File 'app/helpers/users/callouts_helper.rb', line 40

def show_feature_flags_new_version?
  !user_dismissed?(FEATURE_FLAGS_NEW_VERSION)
end

#show_gcp_signup_offer?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'app/helpers/users/callouts_helper.rb', line 26

def 
  !user_dismissed?(GCP_SIGNUP_OFFER)
end

#show_gke_cluster_integration_callout?(project) ⇒ Boolean

Returns:

  • (Boolean)


20
21
22
23
24
# File 'app/helpers/users/callouts_helper.rb', line 20

def show_gke_cluster_integration_callout?(project)
  active_nav_link?(controller: sidebar_operations_paths) &&
    can?(current_user, :create_cluster, project) &&
    !user_dismissed?(GKE_CLUSTER_INTEGRATION)
end

#show_merge_request_settings_callout?(project) ⇒ Boolean

Returns:

  • (Boolean)


70
71
72
# File 'app/helpers/users/callouts_helper.rb', line 70

def show_merge_request_settings_callout?(project)
  !user_dismissed?(MERGE_REQUEST_SETTINGS_MOVED_CALLOUT) && project.merge_requests_enabled?
end

#show_new_navigation_callout?Boolean

Returns:

  • (Boolean)


82
83
84
85
86
87
88
# File 'app/helpers/users/callouts_helper.rb', line 82

def show_new_navigation_callout?
  show_super_sidebar? &&
    !user_dismissed?(NEW_NAVIGATION_CALLOUT) &&
    # GitLab.com users created after the feature flag's full rollout (June 2nd 2023) don't need to see the callout.
    # Remove the gitlab_com_user_created_after_new_nav_rollout? method when the callout isn't needed anymore.
    !gitlab_com_user_created_after_new_nav_rollout?
end

#show_pages_menu_callout?Boolean

Returns:

  • (Boolean)


74
75
76
# File 'app/helpers/users/callouts_helper.rb', line 74

def show_pages_menu_callout?
  !user_dismissed?(PAGES_MOVED_CALLOUT)
end

#show_registration_enabled_user_callout?Boolean

Returns:

  • (Boolean)


48
49
50
51
52
53
54
# File 'app/helpers/users/callouts_helper.rb', line 48

def show_registration_enabled_user_callout?
  !Gitlab.com? &&
    current_user&.can_admin_all_resources? &&
     &&
    !user_dismissed?(REGISTRATION_ENABLED_CALLOUT) &&
    REGISTRATION_ENABLED_CALLOUT_ALLOWED_CONTROLLER_PATHS.any? { |path| controller.controller_path.match?(path) }
end

#show_security_newsletter_user_callout?Boolean

Returns:

  • (Boolean)


59
60
61
62
# File 'app/helpers/users/callouts_helper.rb', line 59

def show_security_newsletter_user_callout?
  current_user&.can_admin_all_resources? &&
    !user_dismissed?(SECURITY_NEWSLETTER_CALLOUT)
end

#show_suggest_popover?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'app/helpers/users/callouts_helper.rb', line 36

def show_suggest_popover?
  !user_dismissed?(SUGGEST_POPOVER_DISMISSED)
end

#show_unfinished_tag_cleanup_callout?Boolean

Returns:

  • (Boolean)


44
45
46
# File 'app/helpers/users/callouts_helper.rb', line 44

def show_unfinished_tag_cleanup_callout?
  !user_dismissed?(UNFINISHED_TAG_CLEANUP_CALLOUT)
end

#web_hook_disabled_dismissed?(object) ⇒ Boolean

Returns:

  • (Boolean)


64
65
66
67
68
# File 'app/helpers/users/callouts_helper.rb', line 64

def web_hook_disabled_dismissed?(object)
  return false unless object.is_a?(::WebHooks::HasWebHooks)

  user_dismissed?(WEB_HOOK_DISABLED, object.last_webhook_failure, object: object)
end