Commit 1d35ba5f authored by Alexandru Croitor's avatar Alexandru Croitor

Remove jira_issue_import feature flag

Remove jira_issue_import feature flag usages, as it has been
already used as default: true.
parent 1998e450
......@@ -6,7 +6,6 @@ module Projects
before_action :authenticate_user!
before_action :check_issues_available!
before_action :authorize_read_project!
before_action :jira_import_enabled?
before_action :jira_integration_configured?
before_action :authorize_admin_project!, only: [:import]
......@@ -44,12 +43,6 @@ module Projects
private
def jira_import_enabled?
return if @project.jira_issues_import_feature_flag_enabled?
redirect_to project_issues_path(@project)
end
def jira_integration_configured?
return if Feature.enabled?(:jira_issue_import_vue, @project, default_enabled: true)
return if @project.jira_service
......
......@@ -14,8 +14,6 @@ module Resolvers
end
def authorized_resource?(project)
return false unless project.jira_issues_import_feature_flag_enabled?
context[:current_user].present? && Ability.allowed?(context[:current_user], :read_project, project)
end
end
......
......@@ -20,7 +20,7 @@ module Resolvers
end
def authorized_resource?(project)
Feature.enabled?(:jira_issue_import, project) && Ability.allowed?(context[:current_user], :admin_project, project)
Ability.allowed?(context[:current_user], :admin_project, project)
end
private
......
......@@ -808,10 +808,6 @@ class Project < ApplicationRecord
Feature.enabled?(:context_commits, default_enabled: true)
end
def jira_issues_import_feature_flag_enabled?
Feature.enabled?(:jira_issue_import, self, default_enabled: true)
end
# LFS and hashed repository storage are required for using Design Management.
def design_management_enabled?
lfs_enabled? && hashed_storage?(:repository)
......@@ -900,7 +896,6 @@ class Project < ApplicationRecord
end
def validate_jira_import_settings!(user: nil)
raise Projects::ImportService::Error, _('Jira import feature is disabled.') unless jira_issues_import_feature_flag_enabled?
raise Projects::ImportService::Error, _('Jira integration not configured.') unless jira_service&.active?
if user
......@@ -1015,7 +1010,7 @@ class Project < ApplicationRecord
end
def jira_import?
import_type == 'jira' && latest_jira_import.present? && jira_issues_import_feature_flag_enabled?
import_type == 'jira' && latest_jira_import.present?
end
def gitlab_project_import?
......
- type = local_assigns.fetch(:type, :icon)
- if @project.jira_issues_import_feature_flag_enabled?
.dropdown.btn-group
.dropdown.btn-group
%button.btn.rounded-right.text-center{ class: ('has-tooltip' if type == :icon), title: (_('Import issues') if type == :icon),
data: { toggle: 'dropdown' }, 'aria-label' => _('Import issues'), 'aria-haspopup' => 'true', 'aria-expanded' => 'false' }
- if type == :icon
......@@ -13,10 +12,3 @@
%button.btn{ data: { toggle: 'modal', target: '.issues-import-modal' } }
= _('Import CSV')
%li= link_to _('Import from Jira'), project_import_jira_path(@project)
- else
%button.csv-import-button.btn{ title: _('Import CSV'), class: ('has-tooltip' if type == :icon),
data: { toggle: 'modal', target: '.issues-import-modal' } }
- if type == :icon
= sprite_icon('import')
- else
= _('Import CSV')
......@@ -6,8 +6,7 @@
= content_for :meta_tags do
= auto_discovery_link_tag(:atom, safe_params.merge(rss_url_options).to_h, title: "#{@project.name} issues")
- if @project.jira_issues_import_feature_flag_enabled?
.js-projects-issues-root{ data: { can_edit: can?(current_user, :admin_project, @project).to_s,
.js-projects-issues-root{ data: { can_edit: can?(current_user, :admin_project, @project).to_s,
is_jira_configured: @project.jira_service.present?.to_s,
issues_path: project_issues_path(@project),
project_path: @project.full_path } }
......
......@@ -27,7 +27,6 @@ module Gitlab
def can_import?(project)
return false unless project
return false unless project.jira_issues_import_feature_flag_enabled?
project.latest_jira_import&.started?
end
......
......@@ -25,7 +25,6 @@ module Gitlab
def start_import
return false unless project
return false unless project.jira_issues_import_feature_flag_enabled?
return true if start(project.latest_jira_import)
Gitlab::Import::Logger.info(
......
......@@ -12174,9 +12174,6 @@ msgstr ""
msgid "Jira Issue Import"
msgstr ""
msgid "Jira import feature is disabled."
msgstr ""
msgid "Jira import is already running."
msgstr ""
......
......@@ -10,10 +10,6 @@ describe Projects::Import::JiraController do
let_it_be(:jira_project_key) { 'Test' }
context 'with anonymous user' do
before do
stub_feature_flags(jira_issue_import: true)
end
context 'get show' do
it 'redirects to issues page' do
get :show, params: { namespace_id: project.namespace, project_id: project }
......@@ -35,33 +31,6 @@ describe Projects::Import::JiraController do
before do
sign_in(user)
project.add_maintainer(user)
end
context 'when feature flag not enabled' do
before do
stub_feature_flags(jira_issue_import: false)
end
context 'get show' do
it 'redirects to issues page' do
get :show, params: { namespace_id: project.namespace, project_id: project }
expect(response).to redirect_to(project_issues_path(project))
end
end
context 'post import' do
it 'redirects to issues page' do
post :import, params: { namespace_id: project.namespace, project_id: project, jira_project_key: jira_project_key }
expect(response).to redirect_to(project_issues_path(project))
end
end
end
context 'when feature flag enabled' do
before do
stub_feature_flags(jira_issue_import: true)
stub_feature_flags(jira_issue_import_vue: false)
stub_jira_service_test
end
......@@ -228,5 +197,4 @@ describe Projects::Import::JiraController do
end
end
end
end
end
......@@ -40,16 +40,6 @@ describe Resolvers::Projects::JiraImportsResolver do
let_it_be(:jira_import1) { create(:jira_import_state, :finished, project: project, jira_project_key: 'AA', created_at: 2.days.ago) }
let_it_be(:jira_import2) { create(:jira_import_state, :finished, project: project, jira_project_key: 'BB', created_at: 5.days.ago) }
context 'when feature flag disabled' do
let(:current_user) { user }
before do
stub_feature_flags(jira_issue_import: false)
end
it_behaves_like 'no Jira import access'
end
context 'when user cannot read Jira imports' do
context 'when anonymous user' do
let(:current_user) { nil }
......
......@@ -8,24 +8,10 @@ describe Gitlab::JiraImport::BaseImporter do
let(:project) { create(:project) }
describe 'with any inheriting class' do
context 'when an error is returned from the project validation' do
before do
stub_feature_flags(jira_issue_import: false)
allow(project).to receive(:validate_jira_import_settings!)
.and_raise(Projects::ImportService::Error, 'Jira import feature is disabled.')
end
it 'raises exception' do
expect { described_class.new(project) }.to raise_error(Projects::ImportService::Error, 'Jira import feature is disabled.')
end
end
context 'when project validation is ok' do
let!(:jira_service) { create(:jira_service, project: project) }
before do
stub_feature_flags(jira_issue_import: true)
stub_jira_service_test
allow(project).to receive(:validate_jira_import_settings!)
......
......@@ -14,7 +14,6 @@ describe Gitlab::JiraImport::IssuesImporter do
subject { described_class.new(project) }
before do
stub_feature_flags(jira_issue_import: true)
stub_jira_service_test
end
......
......@@ -15,7 +15,6 @@ describe Gitlab::JiraImport::LabelsImporter do
subject { importer.execute }
before do
stub_feature_flags(jira_issue_import: true)
stub_const('Gitlab::JiraImport::LabelsImporter::MAX_LABELS', 2)
end
......
......@@ -6053,19 +6053,6 @@ describe Project do
end
shared_examples 'jira configuration base checks' do
context 'when feature flag is disabled' do
before do
stub_feature_flags(jira_issue_import: false)
end
it_behaves_like 'raise Jira import error', 'Jira import feature is disabled.'
end
context 'when feature flag is enabled' do
before do
stub_feature_flags(jira_issue_import: true)
end
context 'when Jira service was not setup' do
it_behaves_like 'raise Jira import error', 'Jira integration not configured.'
end
......@@ -6083,7 +6070,6 @@ describe Project do
end
end
end
end
before do
stub_jira_service_test
......@@ -6116,11 +6102,6 @@ describe Project do
it_behaves_like 'jira configuration base checks'
end
context 'when feature flag is enabled' do
before do
stub_feature_flags(jira_issue_import: true)
end
context 'when user does not have permissions to run the import' do
before do
create(:jira_service, project: project, active: true)
......@@ -6152,7 +6133,6 @@ describe Project do
end
end
end
end
describe '#design_management_enabled?' do
let(:project) { build(:project) }
......
......@@ -29,10 +29,6 @@ describe 'Starting a Jira Import' do
end
context 'when the user does not have permission' do
before do
stub_feature_flags(jira_issue_import: true)
end
shared_examples 'Jira import does not start' do
it 'does not start the Jira import' do
post_graphql_mutation(mutation, current_user: current_user)
......@@ -83,19 +79,6 @@ describe 'Starting a Jira Import' do
end
end
context 'when feature jira_issue_import feature flag is disabled' do
before do
stub_feature_flags(jira_issue_import: false)
end
it_behaves_like 'a mutation that returns errors in the response', errors: ['Jira import feature is disabled.']
end
context 'when feature jira_issue_import feature flag is enabled' do
before do
stub_feature_flags(jira_issue_import: true)
end
context 'when project has no Jira service' do
it_behaves_like 'a mutation that returns errors in the response', errors: ['Jira integration not configured.']
end
......@@ -134,5 +117,4 @@ describe 'Starting a Jira Import' do
end
end
end
end
end
......@@ -11,21 +11,8 @@ describe Gitlab::JiraImport::Stage::FinishImportWorker do
end
describe '#perform' do
context 'when feature flag enabled' do
before do
stub_feature_flags(jira_issue_import: false)
end
it_behaves_like 'cannot do Jira import'
end
context 'when feature flag enabled' do
let_it_be(:jira_import, reload: true) { create(:jira_import_state, :scheduled, project: project) }
before do
stub_feature_flags(jira_issue_import: true)
end
context 'when import did not start' do
it_behaves_like 'cannot do Jira import'
end
......@@ -54,5 +41,4 @@ describe Gitlab::JiraImport::Stage::FinishImportWorker do
end
end
end
end
end
......@@ -10,22 +10,8 @@ describe Gitlab::JiraImport::Stage::ImportAttachmentsWorker do
end
describe '#perform' do
context 'when feature flag disabled' do
before do
stub_feature_flags(jira_issue_import: false)
end
it_behaves_like 'cannot do Jira import'
it_behaves_like 'does not advance to next stage'
end
context 'when feature flag enabled' do
let_it_be(:jira_import) { create(:jira_import_state, :scheduled, project: project) }
before do
stub_feature_flags(jira_issue_import: true)
end
context 'when import did not start' do
it_behaves_like 'cannot do Jira import'
it_behaves_like 'does not advance to next stage'
......@@ -39,5 +25,4 @@ describe Gitlab::JiraImport::Stage::ImportAttachmentsWorker do
it_behaves_like 'advance to next stage', :notes
end
end
end
end
......@@ -13,20 +13,9 @@ describe Gitlab::JiraImport::Stage::ImportIssuesWorker do
end
describe '#perform' do
context 'when feature flag disabled' do
before do
stub_feature_flags(jira_issue_import: false)
end
it_behaves_like 'cannot do Jira import'
it_behaves_like 'does not advance to next stage'
end
context 'when feature flag enabled' do
let_it_be(:jira_import, reload: true) { create(:jira_import_state, :scheduled, project: project) }
before do
stub_feature_flags(jira_issue_import: true)
stub_jira_service_test
end
......@@ -74,5 +63,4 @@ describe Gitlab::JiraImport::Stage::ImportIssuesWorker do
end
end
end
end
end
......@@ -13,22 +13,8 @@ describe Gitlab::JiraImport::Stage::ImportLabelsWorker do
end
describe '#perform' do
context 'when feature flag disabled' do
before do
stub_feature_flags(jira_issue_import: false)
end
it_behaves_like 'cannot do Jira import'
it_behaves_like 'does not advance to next stage'
end
context 'when feature flag enabled' do
let_it_be(:jira_import, reload: true) { create(:jira_import_state, :scheduled, project: project) }
before do
stub_feature_flags(jira_issue_import: true)
end
context 'when import did not start' do
it_behaves_like 'cannot do Jira import'
it_behaves_like 'does not advance to next stage'
......@@ -57,5 +43,4 @@ describe Gitlab::JiraImport::Stage::ImportLabelsWorker do
end
end
end
end
end
......@@ -10,22 +10,8 @@ describe Gitlab::JiraImport::Stage::ImportNotesWorker do
end
describe '#perform' do
context 'when feature flag disabled' do
before do
stub_feature_flags(jira_issue_import: false)
end
it_behaves_like 'cannot do Jira import'
it_behaves_like 'does not advance to next stage'
end
context 'when feature flag enabled' do
let_it_be(:jira_import) { create(:jira_import_state, :scheduled, project: project) }
before do
stub_feature_flags(jira_issue_import: true)
end
context 'when import did not start' do
it_behaves_like 'cannot do Jira import'
it_behaves_like 'does not advance to next stage'
......@@ -39,5 +25,4 @@ describe Gitlab::JiraImport::Stage::ImportNotesWorker do
it_behaves_like 'advance to next stage', :finish
end
end
end
end
......@@ -12,25 +12,8 @@ describe Gitlab::JiraImport::Stage::StartImportWorker do
end
describe '#perform' do
context 'when feature flag not disabled' do
before do
stub_feature_flags(jira_issue_import: false)
end
it 'exits because import not allowed' do
expect(Gitlab::JiraImport::Stage::ImportLabelsWorker).not_to receive(:perform_async)
worker.perform(project.id)
end
end
context 'when feature flag enabled' do
let_it_be(:jira_import, reload: true) { create(:jira_import_state, project: project, jid: jid) }
before do
stub_feature_flags(jira_issue_import: true)
end
context 'when import is not scheduled' do
it 'exits because import not started' do
expect(Gitlab::JiraImport::Stage::ImportLabelsWorker).not_to receive(:perform_async)
......@@ -88,5 +71,4 @@ describe Gitlab::JiraImport::Stage::StartImportWorker do
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