diff options
| author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-08 18:08:27 +0000 |
|---|---|---|
| committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-08 18:08:27 +0000 |
| commit | 99c01aa6867b91b8d2279eb8d32794ea90d5dcdc (patch) | |
| tree | ae36b06dd962230381080d9e2a31385cea5f8609 /app/controllers/projects/import/jira_controller.rb | |
| parent | 5693fb6ba7d21ba7b79775543a3f195eb989664b (diff) | |
| download | gitlab-ce-99c01aa6867b91b8d2279eb8d32794ea90d5dcdc.tar.gz | |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/controllers/projects/import/jira_controller.rb')
| -rw-r--r-- | app/controllers/projects/import/jira_controller.rb | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/app/controllers/projects/import/jira_controller.rb b/app/controllers/projects/import/jira_controller.rb index 25fbb1328e4..976ac7df976 100644 --- a/app/controllers/projects/import/jira_controller.rb +++ b/app/controllers/projects/import/jira_controller.rb @@ -4,27 +4,30 @@ module Projects module Import class JiraController < Projects::ApplicationController before_action :authenticate_user! - before_action :check_issues_available! before_action :authorize_read_project! - before_action :authorize_admin_project!, only: [:import] + before_action :validate_jira_import_settings! def show end - def import - jira_project_key = jira_import_params[:jira_project_key] + private - if jira_project_key.present? - response = ::JiraImport::StartImportService.new(current_user, @project, jira_project_key).execute - flash[:notice] = response.message if response.message.present? - else - flash[:alert] = 'No Jira project key has been provided.' - end + def validate_jira_import_settings! + Gitlab::JiraImport.validate_project_settings!(@project, user: current_user, configuration_check: false) + + true + rescue Projects::ImportService::Error => e + flash[:notice] = e.message + redirect_to project_issues_path(@project) - redirect_to project_import_jira_path(@project) + false end - private + def jira_service + strong_memoize(:jira_service) do + @project.jira_service + end + end def jira_import_params params.permit(:jira_project_key) |
