Commit 9c2c1f3c authored by Sean McGivern's avatar Sean McGivern Committed by Bryce Johnson

Add Projects::IssuesController#service_desk action

parent 5bf11d02
......@@ -6,8 +6,6 @@ class Projects::IssuesController < Projects::ApplicationController
include IssuableCollections
include SpammableActions
prepend ::EE::Projects::IssuesController
prepend_before_action :authenticate_user!, only: [:new, :export_csv]
before_action :check_issues_available!
......@@ -22,6 +20,8 @@ class Projects::IssuesController < Projects::ApplicationController
# Allow create a new branch and empty WIP merge request from current issue
before_action :authorize_create_merge_request!, only: [:create_merge_request]
prepend ::EE::Projects::IssuesController
respond_to :html
def index
......
......@@ -349,6 +349,8 @@ constraints(ProjectUrlConstrainer.new) do
collection do
post :bulk_update
post :export_csv
get :service_desk ## EE-specific
end
resources :issue_links, only: [:index, :create, :destroy], as: 'links', path: 'links'
......
......@@ -5,6 +5,31 @@ module EE
prepended do
before_action :check_export_issues_available!, only: [:export_csv]
before_action :check_service_desk_available!, only: [:service_desk]
skip_before_action :issue, only: [:service_desk]
end
def service_desk
@collection_type = "Issue"
@issues = issues_collection
@issues = @issues.page(params[:page])
@issuable_meta_data = issuable_meta_data(@issues, @collection_type)
if @issues.out_of_range? && @issues.total_pages != 0
return redirect_to url_for(params.merge(page: @issues.total_pages, only_path: true))
end
if params[:label_name].present?
@labels = LabelsFinder.new(current_user, project_id: @project.id, title: params[:label_name]).execute
end
@users = []
if params[:assignee_id].present?
assignee = User.find_by_id(params[:assignee_id])
@users.push(assignee) if assignee
end
end
def export_csv
......@@ -14,6 +39,8 @@ module EE
redirect_to(index_path, notice: "Your CSV export has started. It will be emailed to #{current_user.notification_email} when complete.")
end
private
def issue_params_attributes
attrs = super
attrs.unshift(:weight) if project.feature_available?(:issue_weights)
......@@ -25,8 +52,17 @@ module EE
params = super
params.reject! { |key| key == 'weight' } unless project.feature_available?(:issue_weights)
if action_name == 'service_desk'
params.reject! { |key| key == 'author_username' || key == 'author_id' }
params[:author_id] = ::User.support_bot
end
params
end
def self.skip_issue_actions
super + [:service_desk]
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