Commit b155302d authored by Yorick Peterse's avatar Yorick Peterse

Merge branch 'move-prepend-to-bottom-in-controllers' into 'master'

Move all the prepend in controllers to bottom

Closes #8598

See merge request gitlab-org/gitlab-ee!8921
parents 6844a092 caaa2387
......@@ -4,8 +4,6 @@
#
# Automatically sets the layout and ensures an administrator is logged in
class Admin::ApplicationController < ApplicationController
prepend EE::Admin::ApplicationController # rubocop: disable Cop/InjectEnterpriseEditionModule
before_action :authenticate_admin!
layout 'admin'
......@@ -13,3 +11,5 @@ class Admin::ApplicationController < ApplicationController
render_404 unless current_user.admin?
end
end
Admin::ApplicationController.prepend(EE::Admin::ApplicationController)
# frozen_string_literal: true
class Admin::DashboardController < Admin::ApplicationController
prepend ::EE::Admin::DashboardController # rubocop: disable Cop/InjectEnterpriseEditionModule
include CountHelper
COUNTED_ITEMS = [Project, User, Group, ForkNetworkMember, ForkNetwork, Issue,
......@@ -17,3 +15,5 @@ class Admin::DashboardController < Admin::ApplicationController
end
# rubocop: enable CodeReuse/ActiveRecord
end
Admin::DashboardController.prepend(EE::Admin::DashboardController)
# frozen_string_literal: true
class Admin::ProjectsController < Admin::ApplicationController
prepend EE::Admin::ProjectsController # rubocop: disable Cop/InjectEnterpriseEditionModule
include MembersPresentation
before_action :project, only: [:show, :transfer, :repository_check]
......@@ -68,3 +67,5 @@ class Admin::ProjectsController < Admin::ApplicationController
@group ||= @project.group
end
end
Admin::ProjectsController.prepend(EE::Admin::ProjectsController)
......@@ -2,8 +2,6 @@
module Boards
class ListsController < Boards::ApplicationController
prepend ::EE::Boards::ListsController # rubocop: disable Cop/InjectEnterpriseEditionModule
include BoardsResponses
before_action :authorize_admin_list, only: [:create, :update, :destroy, :generate]
......@@ -85,3 +83,5 @@ module Boards
end
end
end
Boards::ListsController.prepend(EE::Boards::ListsController)
# frozen_string_literal: true
class ConfirmationsController < Devise::ConfirmationsController
prepend ::EE::ConfirmationsController # rubocop: disable Cop/InjectEnterpriseEditionModule
include AcceptsPendingInvitations
def almost_there
......@@ -33,3 +31,5 @@ class ConfirmationsController < Devise::ConfirmationsController
after_sign_in_path_for(resource)
end
end
ConfirmationsController.prepend(EE::ConfirmationsController)
......@@ -6,6 +6,7 @@ class GroupsController < Groups::ApplicationController
include MergeRequestsAction
include ParamsBackwardCompatibility
include PreviewMarkdown
respond_to :html
prepend_before_action(only: [:show, :issues]) { authenticate_sessionless_user!(:rss) }
......
# frozen_string_literal: true
class Import::GithubController < Import::BaseController
prepend ::EE::Import::GithubController # rubocop: disable Cop/InjectEnterpriseEditionModule
before_action :verify_import_enabled
before_action :provider_auth, only: [:status, :jobs, :create]
......@@ -127,3 +125,5 @@ class Import::GithubController < Import::BaseController
{}
end
end
Import::GithubController.prepend(EE::Import::GithubController)
......@@ -32,5 +32,4 @@ class Ldap::OmniauthCallbacksController < OmniauthCallbacksController
end
end
Ldap::OmniauthCallbacksController.prepend(EE::OmniauthCallbacksController) # rubocop: disable Cop/InjectEnterpriseEditionModule
Ldap::OmniauthCallbacksController.prepend(EE::Ldap::OmniauthCallbacksController)
# frozen_string_literal: true
class Projects::AutocompleteSourcesController < Projects::ApplicationController
prepend EE::Projects::AutocompleteSourcesController # rubocop: disable Cop/InjectEnterpriseEditionModule
def members
render json: ::Projects::ParticipantsService.new(@project, current_user).execute(target)
end
......@@ -43,3 +41,5 @@ class Projects::AutocompleteSourcesController < Projects::ApplicationController
.execute(params[:type], params[:type_id])
end
end
Projects::AutocompleteSourcesController.prepend(EE::Projects::AutocompleteSourcesController)
......@@ -15,8 +15,6 @@ class Projects::EnvironmentsController < Projects::ApplicationController
push_frontend_feature_flag(:area_chart, project)
end
prepend ::EE::Projects::EnvironmentsController # rubocop: disable Cop/InjectEnterpriseEditionModule
def index
@environments = project.environments
.with_state(params[:scope] || :available)
......@@ -192,3 +190,5 @@ class Projects::EnvironmentsController < Projects::ApplicationController
access_denied! unless can?(current_user, :stop_environment, environment)
end
end
Projects::EnvironmentsController.prepend(EE::Projects::EnvironmentsController)
......@@ -5,7 +5,6 @@
class Projects::GitHttpClientController < Projects::ApplicationController
include ActionController::HttpAuthentication::Basic
include KerberosSpnegoHelper
prepend ::EE::Projects::GitHttpClientController # rubocop: disable Cop/InjectEnterpriseEditionModule
attr_reader :authentication_result, :redirected_path
......@@ -110,3 +109,5 @@ class Projects::GitHttpClientController < Projects::ApplicationController
authentication_result.ci?(project)
end
end
Projects::GitHttpClientController.prepend(EE::Projects::GitHttpClientController)
......@@ -2,7 +2,6 @@
class Projects::GitHttpController < Projects::GitHttpClientController
include WorkhorseRequest
prepend ::EE::Projects::GitHttpController # rubocop: disable Cop/InjectEnterpriseEditionModule
before_action :access_check
......@@ -97,3 +96,5 @@ class Projects::GitHttpController < Projects::GitHttpClientController
Users::ActivityService.new(user, 'pull').execute
end
end
Projects::GitHttpController.prepend(EE::Projects::GitHttpController)
......@@ -53,4 +53,4 @@ class Projects::GroupLinksController < Projects::ApplicationController
end
end
Projects::GroupLinksController.prepend(::EE::Projects::GroupLinksController)
Projects::GroupLinksController.prepend(EE::Projects::GroupLinksController)
......@@ -75,4 +75,4 @@ class Projects::ImportsController < Projects::ApplicationController
end
end
Projects::ImportsController.prepend(::EE::Projects::ImportsController)
Projects::ImportsController.prepend(EE::Projects::ImportsController)
......@@ -9,13 +9,11 @@ class Projects::IssuesController < Projects::ApplicationController
include IssuesCalendar
include SpammableActions
prepend ::EE::Projects::IssuesController # rubocop: disable Cop/InjectEnterpriseEditionModule
def self.issue_except_actions
def issue_except_actions
%i[index calendar new create bulk_update import_csv]
end
def self.set_issuables_index_only_actions
def set_issuables_index_only_actions
%i[index calendar]
end
......@@ -26,9 +24,9 @@ class Projects::IssuesController < Projects::ApplicationController
before_action :whitelist_query_limiting, only: [:create, :create_merge_request, :move, :bulk_update]
before_action :check_issues_available!
before_action :issue, except: issue_except_actions
before_action :issue, unless: ->(c) { c.issue_except_actions.include?(c.action_name.to_sym) }
before_action :set_issuables_index, only: set_issuables_index_only_actions
before_action :set_issuables_index, if: ->(c) { c.set_issuables_index_only_actions.include?(c.action_name.to_sym) }
# Allow write(create) issue
before_action :authorize_create_issue!, only: [:new, :create]
......@@ -287,3 +285,5 @@ class Projects::IssuesController < Projects::ApplicationController
push_frontend_feature_flag(:graphql, default_enabled: true)
end
end
Projects::IssuesController.prepend(EE::Projects::IssuesController)
......@@ -124,4 +124,4 @@ class Projects::LfsApiController < Projects::GitHttpClientController
end
end
Projects::LfsApiController.prepend(::EE::Projects::LfsApiController)
Projects::LfsApiController.prepend(EE::Projects::LfsApiController)
# frozen_string_literal: true
class Projects::MergeRequests::ApplicationController < Projects::ApplicationController
prepend ::EE::Projects::MergeRequests::ApplicationController # rubocop: disable Cop/InjectEnterpriseEditionModule
before_action :check_merge_requests_available!
before_action :merge_request
before_action :authorize_read_merge_request!
......@@ -46,3 +44,5 @@ class Projects::MergeRequests::ApplicationController < Projects::ApplicationCont
@statuses_count = @pipeline.present? ? @pipeline.statuses.relevant.count : 0
end
end
Projects::MergeRequests::ApplicationController.prepend(EE::Projects::MergeRequests::ApplicationController)
# frozen_string_literal: true
class Projects::MergeRequests::DiffsController < Projects::MergeRequests::ApplicationController
prepend ::EE::Projects::MergeRequests::DiffsController # rubocop: disable Cop/InjectEnterpriseEditionModule
include DiffForPath
include DiffHelper
include RendersNotes
......@@ -120,3 +118,5 @@ class Projects::MergeRequests::DiffsController < Projects::MergeRequests::Applic
@notes
end
end
Projects::MergeRequests::DiffsController.prepend(EE::Projects::MergeRequests::DiffsController)
......@@ -8,8 +8,6 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo
include ToggleAwardEmoji
include IssuableCollections
prepend ::EE::Projects::MergeRequestsController # rubocop: disable Cop/InjectEnterpriseEditionModule
skip_before_action :merge_request, only: [:index, :bulk_update]
before_action :whitelist_query_limiting, only: [:assign_related_issues, :update]
before_action :authorize_update_issuable!, only: [:close, :edit, :update, :remove_wip, :sort]
......@@ -349,3 +347,5 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo
Gitlab::QueryLimiting.whitelist('https://gitlab.com/gitlab-org/gitlab-ce/issues/42438')
end
end
Projects::MergeRequestsController.prepend(EE::Projects::MergeRequestsController)
# frozen_string_literal: true
class Projects::PipelinesController < Projects::ApplicationController
prepend ::EE::Projects::PipelinesController # rubocop: disable Cop/InjectEnterpriseEditionModule
before_action :whitelist_query_limiting, only: [:create, :retry]
before_action :pipeline, except: [:index, :new, :create, :charts]
before_action :authorize_read_pipeline!
......@@ -188,3 +186,5 @@ class Projects::PipelinesController < Projects::ApplicationController
view_context.limited_counter_with_delimiter(finder.execute)
end
end
Projects::PipelinesController.prepend(EE::Projects::PipelinesController)
......@@ -66,4 +66,4 @@ class Projects::ProtectedRefsController < Projects::ApplicationController
end
end
Projects::ProtectedRefsController.prepend(::EE::Projects::ProtectedRefsController)
Projects::ProtectedRefsController.prepend(EE::Projects::ProtectedRefsController)
......@@ -6,8 +6,6 @@ module Projects
before_action :authorize_admin_pipeline!
before_action :define_variables
prepend ::EE::Projects::Settings::CiCdController # rubocop: disable Cop/InjectEnterpriseEditionModule
def show
end
......@@ -121,3 +119,5 @@ module Projects
end
end
end
Projects::Settings::CiCdController.prepend(EE::Projects::Settings::CiCdController)
......@@ -6,8 +6,6 @@ module Projects
before_action :authorize_admin_project!
before_action :remote_mirror, only: [:show]
prepend ::EE::Projects::Settings::RepositoryController # rubocop: disable Cop/InjectEnterpriseEditionModule
def show
render_show
end
......@@ -106,3 +104,5 @@ module Projects
end
end
end
Projects::Settings::RepositoryController.prepend(EE::Projects::Settings::RepositoryController)
# frozen_string_literal: true
class Projects::VariablesController < Projects::ApplicationController
prepend ::EE::Projects::VariablesController # rubocop: disable Cop/InjectEnterpriseEditionModule
before_action :authorize_admin_build!
def show
......@@ -43,3 +41,5 @@ class Projects::VariablesController < Projects::ApplicationController
%i[id key secret_value protected _destroy]
end
end
Projects::VariablesController.prepend(EE::Projects::VariablesController)
......@@ -6,6 +6,7 @@ class SessionsController < Devise::SessionsController
include Devise::Controllers::Rememberable
include Recaptcha::ClientHelper
include Recaptcha::Verify
skip_before_action :check_two_factor_requirement, only: [:destroy]
prepend_before_action :check_initial_setup, only: [:new]
......
......@@ -4,6 +4,7 @@ class UsersController < ApplicationController
include RoutableActions
include RendersMemberAccess
include ControllerWithCrossProjectAccessCheck
requires_cross_project_access show: false,
groups: false,
projects: false,
......
......@@ -29,7 +29,7 @@ module EE
# git-lfs: https://github.com/git-lfs/git-lfs/blob/master/docs/api
#
prepended do
before_action do
prepend_before_action do
redirect_to(primary_full_url) if redirect?
end
end
......
......@@ -4,6 +4,7 @@ module EE
module Projects
module IssuesController
extend ActiveSupport::Concern
extend ::Gitlab::Utils::Override
prepended do
before_action :authenticate_user!, only: [:export_csv]
......@@ -12,9 +13,6 @@ module EE
before_action :whitelist_query_limiting_ee, only: [:update]
end
class_methods do
extend ::Gitlab::Utils::Override
override :issue_except_actions
def issue_except_actions
super + %i[export_csv service_desk]
......@@ -24,7 +22,6 @@ module EE
def set_issuables_index_only_actions
super + %i[service_desk]
end
end
def service_desk
@issues = @issuables # rubocop:disable Gitlab/ModuleWithInstanceVariables
......
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