Commit 62dbee1b authored by Sean McGivern's avatar Sean McGivern

Merge branch 'controller-feature-categories-h-z' into 'master'

Controller feature categories H-Z

See merge request gitlab-org/gitlab!44150
parents 047387d6 a7583be1
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
class HelpController < ApplicationController class HelpController < ApplicationController
skip_before_action :authenticate_user!, unless: :public_visibility_restricted? skip_before_action :authenticate_user!, unless: :public_visibility_restricted?
feature_category :not_owned
layout 'help' layout 'help'
......
...@@ -11,6 +11,8 @@ class IdeController < ApplicationController ...@@ -11,6 +11,8 @@ class IdeController < ApplicationController
push_frontend_feature_flag(:schema_linting) push_frontend_feature_flag(:schema_linting)
end end
feature_category :web_ide
def index def index
Gitlab::UsageDataCounters::WebIdeCounter.increment_views_count Gitlab::UsageDataCounters::WebIdeCounter.increment_views_count
end end
......
# frozen_string_literal: true # frozen_string_literal: true
class Import::AvailableNamespacesController < ApplicationController class Import::AvailableNamespacesController < ApplicationController
feature_category :importers
def index def index
render json: NamespaceSerializer.new.represent(current_user.manageable_groups_with_routes) render json: NamespaceSerializer.new.represent(current_user.manageable_groups_with_routes)
end end
......
...@@ -4,6 +4,7 @@ class Import::BaseController < ApplicationController ...@@ -4,6 +4,7 @@ class Import::BaseController < ApplicationController
include ActionView::Helpers::SanitizeHelper include ActionView::Helpers::SanitizeHelper
before_action :import_rate_limit, only: [:create] before_action :import_rate_limit, only: [:create]
feature_category :importers
def status def status
respond_to do |format| respond_to do |format|
......
...@@ -4,6 +4,8 @@ class Import::BulkImportsController < ApplicationController ...@@ -4,6 +4,8 @@ class Import::BulkImportsController < ApplicationController
before_action :ensure_group_import_enabled before_action :ensure_group_import_enabled
before_action :verify_blocked_uri, only: :status before_action :verify_blocked_uri, only: :status
feature_category :importers
def configure def configure
session[access_token_key] = params[access_token_key]&.strip session[access_token_key] = params[access_token_key]&.strip
session[url_key] = params[url_key] session[url_key] = params[url_key]
......
...@@ -6,6 +6,8 @@ class Import::GitlabGroupsController < ApplicationController ...@@ -6,6 +6,8 @@ class Import::GitlabGroupsController < ApplicationController
before_action :ensure_group_import_enabled before_action :ensure_group_import_enabled
before_action :import_rate_limit, only: %i[create] before_action :import_rate_limit, only: %i[create]
feature_category :importers
def create def create
unless file_is_valid?(group_params[:file]) unless file_is_valid?(group_params[:file])
return redirect_back_or_default(options: { alert: s_('GroupImport|Unable to process group import file') }) return redirect_back_or_default(options: { alert: s_('GroupImport|Unable to process group import file') })
......
...@@ -12,6 +12,8 @@ class InvitesController < ApplicationController ...@@ -12,6 +12,8 @@ class InvitesController < ApplicationController
respond_to :html respond_to :html
feature_category :authentication_and_authorization
def show def show
track_new_user_invite_experiment('opened') track_new_user_invite_experiment('opened')
accept if skip_invitation_prompt? accept if skip_invitation_prompt?
......
...@@ -7,6 +7,8 @@ class JiraConnect::ApplicationController < ApplicationController ...@@ -7,6 +7,8 @@ class JiraConnect::ApplicationController < ApplicationController
skip_before_action :verify_authenticity_token skip_before_action :verify_authenticity_token
before_action :verify_atlassian_jwt! before_action :verify_atlassian_jwt!
feature_category :integrations
attr_reader :current_jira_installation attr_reader :current_jira_installation
private private
......
...@@ -8,6 +8,8 @@ class JwtController < ApplicationController ...@@ -8,6 +8,8 @@ class JwtController < ApplicationController
# Add this before other actions, since we want to have the user or project # Add this before other actions, since we want to have the user or project
prepend_before_action :auth_user, :authenticate_project_or_user prepend_before_action :auth_user, :authenticate_project_or_user
feature_category :authentication_and_authorization
SERVICES = { SERVICES = {
Auth::ContainerRegistryAuthenticationService::AUDIENCE => Auth::ContainerRegistryAuthenticationService Auth::ContainerRegistryAuthenticationService::AUDIENCE => Auth::ContainerRegistryAuthenticationService
}.freeze }.freeze
......
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
class NotificationSettingsController < ApplicationController class NotificationSettingsController < ApplicationController
before_action :authenticate_user! before_action :authenticate_user!
feature_category :users
def create def create
return render_404 unless can_read?(resource) return render_404 unless can_read?(resource)
......
...@@ -8,6 +8,8 @@ class Oauth::Jira::AuthorizationsController < ApplicationController ...@@ -8,6 +8,8 @@ class Oauth::Jira::AuthorizationsController < ApplicationController
skip_before_action :authenticate_user! skip_before_action :authenticate_user!
skip_before_action :verify_authenticity_token skip_before_action :verify_authenticity_token
feature_category :integrations
# 1. Rewire Jira OAuth initial request to our stablished OAuth authorization URL. # 1. Rewire Jira OAuth initial request to our stablished OAuth authorization URL.
def new def new
session[:redirect_uri] = params['redirect_uri'] session[:redirect_uri] = params['redirect_uri']
......
...@@ -11,6 +11,8 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController ...@@ -11,6 +11,8 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController
protect_from_forgery except: [:kerberos, :saml, :cas3, :failure], with: :exception, prepend: true protect_from_forgery except: [:kerberos, :saml, :cas3, :failure], with: :exception, prepend: true
feature_category :authentication_and_authorization
def handle_omniauth def handle_omniauth
omniauth_flow(Gitlab::Auth::OAuth) omniauth_flow(Gitlab::Auth::OAuth)
end end
......
...@@ -7,6 +7,8 @@ module Registrations ...@@ -7,6 +7,8 @@ module Registrations
before_action :check_experiment_enabled before_action :check_experiment_enabled
before_action :ensure_namespace_path_param before_action :ensure_namespace_path_param
feature_category :navigation
def update def update
current_user.experience_level = params[:experience_level] current_user.experience_level = params[:experience_level]
......
...@@ -15,6 +15,8 @@ class RegistrationsController < Devise::RegistrationsController ...@@ -15,6 +15,8 @@ class RegistrationsController < Devise::RegistrationsController
if: -> { action_name == 'create' && Gitlab::CurrentSettings.current_application_settings.enforce_terms? } if: -> { action_name == 'create' && Gitlab::CurrentSettings.current_application_settings.enforce_terms? }
before_action :load_recaptcha, only: :new before_action :load_recaptcha, only: :new
feature_category :authentication_and_authorization
def new def new
if experiment_enabled?(:signup_flow) if experiment_enabled?(:signup_flow)
track_experiment_event(:terms_opt_in, 'start') track_experiment_event(:terms_opt_in, 'start')
......
...@@ -20,6 +20,8 @@ module Repositories ...@@ -20,6 +20,8 @@ module Repositories
prepend_before_action :authenticate_user, :parse_repo_path prepend_before_action :authenticate_user, :parse_repo_path
feature_category :source_code_management
private private
def download_request? def download_request?
......
# frozen_string_literal: true # frozen_string_literal: true
class RunnerSetupController < ApplicationController class RunnerSetupController < ApplicationController
feature_category :continuous_integration
def platforms def platforms
render json: Gitlab::Ci::RunnerInstructions::OS.merge(Gitlab::Ci::RunnerInstructions::OTHER_ENVIRONMENTS) render json: Gitlab::Ci::RunnerInstructions::OS.merge(Gitlab::Ci::RunnerInstructions::OTHER_ENVIRONMENTS)
end end
......
...@@ -25,6 +25,8 @@ class SearchController < ApplicationController ...@@ -25,6 +25,8 @@ class SearchController < ApplicationController
layout 'search' layout 'search'
feature_category :global_search
def show def show
@project = search_service.project @project = search_service.project
@group = search_service.group @group = search_service.group
......
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
class SentNotificationsController < ApplicationController class SentNotificationsController < ApplicationController
skip_before_action :authenticate_user! skip_before_action :authenticate_user!
feature_category :users
def unsubscribe def unsubscribe
@sent_notification = SentNotification.for(params[:id]) @sent_notification = SentNotification.for(params[:id])
......
...@@ -49,6 +49,8 @@ class SessionsController < Devise::SessionsController ...@@ -49,6 +49,8 @@ class SessionsController < Devise::SessionsController
# token mismatch. # token mismatch.
protect_from_forgery with: :exception, prepend: true, except: :destroy protect_from_forgery with: :exception, prepend: true, except: :destroy
feature_category :authentication_and_authorization
CAPTCHA_HEADER = 'X-GitLab-Show-Login-Captcha' CAPTCHA_HEADER = 'X-GitLab-Show-Login-Captcha'
MAX_FAILED_LOGIN_ATTEMPTS = 5 MAX_FAILED_LOGIN_ATTEMPTS = 5
......
...@@ -4,6 +4,8 @@ class Snippets::ApplicationController < ApplicationController ...@@ -4,6 +4,8 @@ class Snippets::ApplicationController < ApplicationController
include FindSnippet include FindSnippet
include SnippetAuthorizations include SnippetAuthorizations
feature_category :snippets
private private
def authorize_read_snippet! def authorize_read_snippet!
......
...@@ -8,6 +8,8 @@ class Snippets::NotesController < ApplicationController ...@@ -8,6 +8,8 @@ class Snippets::NotesController < ApplicationController
before_action :authorize_read_snippet!, only: [:show, :index] before_action :authorize_read_snippet!, only: [:show, :index]
before_action :authorize_create_note!, only: [:create] before_action :authorize_create_note!, only: [:create]
feature_category :snippets
private private
def note def note
......
...@@ -25,6 +25,8 @@ class UploadsController < ApplicationController ...@@ -25,6 +25,8 @@ class UploadsController < ApplicationController
before_action :authorize_create_access!, only: [:create, :authorize] before_action :authorize_create_access!, only: [:create, :authorize]
before_action :verify_workhorse_api!, only: [:authorize] before_action :verify_workhorse_api!, only: [:authorize]
feature_category :not_owned
def uploader_class def uploader_class
PersonalFileUploader PersonalFileUploader
end end
......
# frozen_string_literal: true # frozen_string_literal: true
class UserCalloutsController < ApplicationController class UserCalloutsController < ApplicationController
feature_category :navigation
def create def create
callout = ensure_callout callout = ensure_callout
......
...@@ -14,6 +14,8 @@ module Users ...@@ -14,6 +14,8 @@ module Users
layout 'terms' layout 'terms'
feature_category :users
def index def index
@redirect = redirect_path @redirect = redirect_path
......
...@@ -21,6 +21,8 @@ class UsersController < ApplicationController ...@@ -21,6 +21,8 @@ class UsersController < ApplicationController
before_action :authorize_read_user_profile!, before_action :authorize_read_user_profile!,
only: [:calendar, :calendar_activities, :groups, :projects, :contributed_projects, :starred_projects, :snippets] only: [:calendar, :calendar_activities, :groups, :projects, :contributed_projects, :starred_projects, :snippets]
feature_category :users
def show def show
respond_to do |format| respond_to do |format|
format.html format.html
......
...@@ -5,6 +5,8 @@ class OmniauthKerberosSpnegoController < ApplicationController ...@@ -5,6 +5,8 @@ class OmniauthKerberosSpnegoController < ApplicationController
skip_before_action :authenticate_user! skip_before_action :authenticate_user!
feature_category :authentication_and_authorization
def negotiate def negotiate
if spnego_provided? && (krb_principal = spnego_credentials!(spnego_token)) if spnego_provided? && (krb_principal = spnego_credentials!(spnego_token))
session[OmniAuth::Strategies::KerberosSpnego::SESSION_KEY] = krb_principal session[OmniAuth::Strategies::KerberosSpnego::SESSION_KEY] = krb_principal
......
...@@ -5,6 +5,8 @@ class OperationsController < ApplicationController ...@@ -5,6 +5,8 @@ class OperationsController < ApplicationController
respond_to :json, only: [:list] respond_to :json, only: [:list]
feature_category :release_orchestration
POLLING_INTERVAL = 120_000 POLLING_INTERVAL = 120_000
def index def index
......
...@@ -7,6 +7,8 @@ module Registrations ...@@ -7,6 +7,8 @@ module Registrations
before_action :authorize_create_group!, only: :new before_action :authorize_create_group!, only: :new
before_action :check_experiment_enabled before_action :check_experiment_enabled
feature_category :navigation
def new def new
@group = Group.new(visibility_level: helpers.default_group_visibility) @group = Group.new(visibility_level: helpers.default_group_visibility)
end end
......
...@@ -7,6 +7,8 @@ module Registrations ...@@ -7,6 +7,8 @@ module Registrations
before_action :check_experiment_enabled before_action :check_experiment_enabled
before_action :find_namespace, only: :new before_action :find_namespace, only: :new
feature_category :navigation
def new def new
@project = Project.new(namespace: @namespace) @project = Project.new(namespace: @namespace)
end end
......
...@@ -9,6 +9,8 @@ module Security ...@@ -9,6 +9,8 @@ module Security
push_frontend_feature_flag(:instance_security_dashboard, default_enabled: true) push_frontend_feature_flag(:instance_security_dashboard, default_enabled: true)
end end
feature_category :vulnerability_management
protected protected
def check_feature_enabled! def check_feature_enabled!
......
...@@ -9,6 +9,8 @@ class SmartcardController < ApplicationController ...@@ -9,6 +9,8 @@ class SmartcardController < ApplicationController
before_action :check_ngingx_certificate_header, only: :extract_certificate before_action :check_ngingx_certificate_header, only: :extract_certificate
before_action :check_certificate_param, only: :verify_certificate before_action :check_certificate_param, only: :verify_certificate
feature_category :authentication_and_authorization
def auth def auth
redirect_to extract_certificate_smartcard_url(extract_certificate_url_options) redirect_to extract_certificate_smartcard_url(extract_certificate_url_options)
end end
......
...@@ -8,6 +8,8 @@ module Subscriptions ...@@ -8,6 +8,8 @@ module Subscriptions
before_action :find_group before_action :find_group
feature_category :purchase
def edit def edit
end end
......
...@@ -4,6 +4,8 @@ class SubscriptionsController < ApplicationController ...@@ -4,6 +4,8 @@ class SubscriptionsController < ApplicationController
layout 'checkout' layout 'checkout'
skip_before_action :authenticate_user!, only: :new skip_before_action :authenticate_user!, only: :new
feature_category :purchase
content_security_policy do |p| content_security_policy do |p|
next if p.directives.blank? next if p.directives.blank?
......
...@@ -7,6 +7,8 @@ class SurveyResponsesController < ApplicationController ...@@ -7,6 +7,8 @@ class SurveyResponsesController < ApplicationController
skip_before_action :authenticate_user! skip_before_action :authenticate_user!
feature_category :collection
def index def index
track_response if Gitlab.com? track_response if Gitlab.com?
......
...@@ -10,6 +10,8 @@ class TrialsController < ApplicationController ...@@ -10,6 +10,8 @@ class TrialsController < ApplicationController
before_action :find_or_create_namespace, only: :apply before_action :find_or_create_namespace, only: :apply
before_action :record_user_for_group_only_trials_experiment, only: :select before_action :record_user_for_group_only_trials_experiment, only: :select
feature_category :purchase
def new def new
end end
......
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
class UnsubscribesController < ApplicationController class UnsubscribesController < ApplicationController
skip_before_action :authenticate_user! skip_before_action :authenticate_user!
feature_category :users
def show def show
@user = get_user @user = get_user
end end
......
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
class UsernamesController < ApplicationController class UsernamesController < ApplicationController
skip_before_action :authenticate_user!, only: [:suggest] skip_before_action :authenticate_user!, only: [:suggest]
feature_category :users
def suggest def suggest
if validate_params if validate_params
username = ::User.username_suggestion(params[:name]) username = ::User.username_suggestion(params[:name])
......
...@@ -24,19 +24,19 @@ RSpec.describe "Every controller" do ...@@ -24,19 +24,19 @@ RSpec.describe "Every controller" do
let_it_be(:routes_without_category) do let_it_be(:routes_without_category) do
controller_actions.map do |controller, action| controller_actions.map do |controller, action|
next if controller.feature_category_for_action(action) next if controller.feature_category_for_action(action)
next unless controller.to_s.start_with?('B', 'C', 'D', 'E', 'F', 'Projects::MergeRequestsController')
next unless controller.to_s.start_with?('B', 'C', 'D', 'E', 'F',
'H', 'I', 'J', 'K', 'L',
'M', 'N', 'O', 'Q', 'R',
'S', 'T', 'U', 'V', 'W',
'X', 'Y', 'Z',
'Projects::MergeRequestsController')
"#{controller}##{action}" "#{controller}##{action}"
end.compact end.compact
end end
it "has feature categories" do it "has feature categories" do
routes_without_category.map { |x| x.split('#') }.group_by(&:first).each do |controller, actions|
puts controller
puts actions.map { |x| ":#{x.last}" }.sort.join(', ')
puts ''
end
expect(routes_without_category).to be_empty, "#{routes_without_category} did not have a category" expect(routes_without_category).to be_empty, "#{routes_without_category} did not have a category"
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment