Commit a81914c7 authored by Arturo Herrero's avatar Arturo Herrero

Ignore default column from services table

default column from services table is only set to true for
GitLabIssueTrackerService. After removing the GitlabIssueTrackerService
class 788a4d24 we can ignore the column before dropping it.
parent 7a89ded4
...@@ -10,6 +10,7 @@ class Service < ApplicationRecord ...@@ -10,6 +10,7 @@ class Service < ApplicationRecord
include IgnorableColumns include IgnorableColumns
ignore_columns %i[title description], remove_with: '13.4', remove_after: '2020-09-22' ignore_columns %i[title description], remove_with: '13.4', remove_after: '2020-09-22'
ignore_columns %i[default], remove_with: '13.5', remove_after: '2020-10-22'
SERVICE_NAMES = %w[ SERVICE_NAMES = %w[
alerts asana assembla bamboo bugzilla buildkite campfire confluence custom_issue_tracker discord alerts asana assembla bamboo bugzilla buildkite campfire confluence custom_issue_tracker discord
......
...@@ -96,7 +96,7 @@ module Admin ...@@ -96,7 +96,7 @@ module Admin
# rubocop: disable CodeReuse/ActiveRecord # rubocop: disable CodeReuse/ActiveRecord
def run_callbacks(batch) def run_callbacks(batch)
if active_external_issue_tracker? if integration.issue_tracker?
Project.where(id: batch).update_all(has_external_issue_tracker: true) Project.where(id: batch).update_all(has_external_issue_tracker: true)
end end
...@@ -106,10 +106,6 @@ module Admin ...@@ -106,10 +106,6 @@ module Admin
end end
# rubocop: enable CodeReuse/ActiveRecord # rubocop: enable CodeReuse/ActiveRecord
def active_external_issue_tracker?
integration.issue_tracker? && !integration.default
end
def active_external_wiki? def active_external_wiki?
integration.type == 'ExternalWikiService' integration.type == 'ExternalWikiService'
end end
......
...@@ -66,7 +66,7 @@ module Projects ...@@ -66,7 +66,7 @@ module Projects
# rubocop: disable CodeReuse/ActiveRecord # rubocop: disable CodeReuse/ActiveRecord
def run_callbacks(batch) def run_callbacks(batch)
if active_external_issue_tracker? if template.issue_tracker?
Project.where(id: batch).update_all(has_external_issue_tracker: true) Project.where(id: batch).update_all(has_external_issue_tracker: true)
end end
...@@ -76,10 +76,6 @@ module Projects ...@@ -76,10 +76,6 @@ module Projects
end end
# rubocop: enable CodeReuse/ActiveRecord # rubocop: enable CodeReuse/ActiveRecord
def active_external_issue_tracker?
template.issue_tracker? && !template.default
end
def active_external_wiki? def active_external_wiki?
template.type == 'ExternalWikiService' template.type == 'ExternalWikiService'
end end
......
...@@ -4,7 +4,7 @@ require 'spec_helper' ...@@ -4,7 +4,7 @@ require 'spec_helper'
RSpec.describe Admin::PropagateIntegrationService do RSpec.describe Admin::PropagateIntegrationService do
describe '.propagate' do describe '.propagate' do
let(:excluded_attributes) { %w[id project_id inherit_from_id instance created_at updated_at title description] } let(:excluded_attributes) { %w[id project_id inherit_from_id instance created_at updated_at default] }
let!(:project) { create(:project) } let!(:project) { create(:project) }
let!(:instance_integration) do let!(:instance_integration) do
JiraService.create!( JiraService.create!(
......
...@@ -20,7 +20,7 @@ RSpec.describe Projects::PropagateServiceTemplate do ...@@ -20,7 +20,7 @@ RSpec.describe Projects::PropagateServiceTemplate do
end end
let!(:project) { create(:project) } let!(:project) { create(:project) }
let(:excluded_attributes) { %w[id project_id template created_at updated_at title description] } let(:excluded_attributes) { %w[id project_id template created_at updated_at default] }
it 'creates services for projects' do it 'creates services for projects' do
expect(project.pushover_service).to be_nil expect(project.pushover_service).to be_nil
...@@ -120,7 +120,7 @@ RSpec.describe Projects::PropagateServiceTemplate do ...@@ -120,7 +120,7 @@ RSpec.describe Projects::PropagateServiceTemplate do
describe 'external tracker' do describe 'external tracker' do
it 'updates the project external tracker' do it 'updates the project external tracker' do
service_template.update!(category: 'issue_tracker', default: false) service_template.update!(category: 'issue_tracker')
expect { described_class.propagate(service_template) } expect { described_class.propagate(service_template) }
.to change { project.reload.has_external_issue_tracker }.to(true) .to change { project.reload.has_external_issue_tracker }.to(true)
......
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