debian-mirror-gitlab/app/controllers/projects/import/jira_controller.rb

38 lines
845 B
Ruby
Raw Normal View History

2020-04-08 14:13:33 +05:30
# frozen_string_literal: true
module Projects
module Import
class JiraController < Projects::ApplicationController
2020-04-22 19:07:51 +05:30
before_action :authenticate_user!
before_action :authorize_read_project!
2020-06-23 00:09:42 +05:30
before_action :validate_jira_import_settings!
2020-04-08 14:13:33 +05:30
def show
end
private
2020-06-23 00:09:42 +05:30
def validate_jira_import_settings!
Gitlab::JiraImport.validate_project_settings!(@project, user: current_user, configuration_check: false)
2020-04-08 14:13:33 +05:30
2020-06-23 00:09:42 +05:30
true
rescue Projects::ImportService::Error => e
flash[:notice] = e.message
2020-04-08 14:13:33 +05:30
redirect_to project_issues_path(@project)
2020-06-23 00:09:42 +05:30
false
end
2020-04-08 14:13:33 +05:30
2020-06-23 00:09:42 +05:30
def jira_service
strong_memoize(:jira_service) do
@project.jira_service
end
2020-04-08 14:13:33 +05:30
end
def jira_import_params
params.permit(:jira_project_key)
end
end
end
end