summaryrefslogtreecommitdiff
path: root/app/controllers/projects/import/jira_controller.rb
blob: 8418a6076599ba2a5b833f0b8b90452b42e5bd64 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# frozen_string_literal: true

module Projects
  module Import
    class JiraController < Projects::ApplicationController
      before_action :authenticate_user!
      before_action :authorize_read_project!
      before_action :validate_jira_import_settings!

      feature_category :integrations

      def show
      end

      private

      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)

        false
      end

      def jira_service
        strong_memoize(:jira_service) do
          @project.jira_service
        end
      end

      def jira_import_params
        params.permit(:jira_project_key)
      end
    end
  end
end