Commit 1a7a861f authored by Sean McGivern's avatar Sean McGivern

Extract EE-specific lines from issues controller

parent 506a5f8f
...@@ -9,14 +9,27 @@ class Projects::IssuesController < Projects::ApplicationController ...@@ -9,14 +9,27 @@ class Projects::IssuesController < Projects::ApplicationController
include IssuesCalendar include IssuesCalendar
include SpammableActions include SpammableActions
prepend_before_action :authenticate_user!, only: [:new, :export_csv] prepend ::EE::Projects::IssuesController
def self.authenticate_user_only_actions
%i[new]
end
def self.issue_except_actions
%i[index calendar new create bulk_update]
end
def self.set_issuables_index_only_actions
%i[index calendar]
end
prepend_before_action :authenticate_user!, only: authenticate_user_only_actions
before_action :whitelist_query_limiting_ee, only: [:update]
before_action :whitelist_query_limiting, only: [:create, :create_merge_request, :move, :bulk_update] before_action :whitelist_query_limiting, only: [:create, :create_merge_request, :move, :bulk_update]
before_action :check_issues_available! before_action :check_issues_available!
before_action :issue, except: [:index, :calendar, :new, :create, :bulk_update, :export_csv] before_action :issue, except: issue_except_actions
before_action :set_issuables_index, only: [:index, :calendar] before_action :set_issuables_index, only: set_issuables_index_only_actions
# Allow write(create) issue # Allow write(create) issue
before_action :authorize_create_issue!, only: [:new, :create] before_action :authorize_create_issue!, only: [:new, :create]
...@@ -27,8 +40,6 @@ class Projects::IssuesController < Projects::ApplicationController ...@@ -27,8 +40,6 @@ class Projects::IssuesController < Projects::ApplicationController
# Allow create a new branch and empty WIP merge request from current issue # Allow create a new branch and empty WIP merge request from current issue
before_action :authorize_create_merge_request_from!, only: [:create_merge_request] before_action :authorize_create_merge_request_from!, only: [:create_merge_request]
prepend ::EE::Projects::IssuesController
respond_to :html respond_to :html
def index def index
...@@ -254,8 +265,4 @@ class Projects::IssuesController < Projects::ApplicationController ...@@ -254,8 +265,4 @@ class Projects::IssuesController < Projects::ApplicationController
# 3. https://gitlab.com/gitlab-org/gitlab-ce/issues/42426 # 3. https://gitlab.com/gitlab-org/gitlab-ce/issues/42426
Gitlab::QueryLimiting.whitelist('https://gitlab.com/gitlab-org/gitlab-ce/issues/42422') Gitlab::QueryLimiting.whitelist('https://gitlab.com/gitlab-org/gitlab-ce/issues/42422')
end end
def whitelist_query_limiting_ee
Gitlab::QueryLimiting.whitelist('https://gitlab.com/gitlab-org/gitlab-ee/issues/4794')
end
end end
# frozen_string_literal: true
module EE module EE
module Projects module Projects
module IssuesController module IssuesController
...@@ -6,8 +8,26 @@ module EE ...@@ -6,8 +8,26 @@ module EE
prepended do prepended do
before_action :check_export_issues_available!, only: [:export_csv] before_action :check_export_issues_available!, only: [:export_csv]
before_action :check_service_desk_available!, only: [:service_desk] before_action :check_service_desk_available!, only: [:service_desk]
before_action :set_issuables_index, only: [:index, :calendar, :service_desk] before_action :whitelist_query_limiting_ee, only: [:update]
skip_before_action :issue, only: [:service_desk] end
class_methods do
extend ::Gitlab::Utils::Override
override :authenticate_user_only_actions
def authenticate_user_only_actions
super + %i[export_csv]
end
override :issue_except_actions
def issue_except_actions
super + %i[export_csv service_desk]
end
override :set_issuables_index_only_actions
def set_issuables_index_only_actions
super + %i[service_desk]
end
end end
def service_desk def service_desk
...@@ -46,6 +66,10 @@ module EE ...@@ -46,6 +66,10 @@ module EE
def service_desk? def service_desk?
action_name == 'service_desk' action_name == 'service_desk'
end end
def whitelist_query_limiting_ee
::Gitlab::QueryLimiting.whitelist('https://gitlab.com/gitlab-org/gitlab-ee/issues/4794')
end
end end
end end
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