diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-23 03:08:30 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-23 03:08:30 +0300 |
commit | e6dd804c902b030e2178be0c9ec5c38b58bd2b14 (patch) | |
tree | 9cabaea51989befe4d8c2e65ebac11afdd5dc493 /app/services/bulk_create_integration_service.rb | |
parent | e5356e229f5a1181d1a49091d6dc611db68bfffb (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services/bulk_create_integration_service.rb')
-rw-r--r-- | app/services/bulk_create_integration_service.rb | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/app/services/bulk_create_integration_service.rb b/app/services/bulk_create_integration_service.rb index 23b89b0d8a9..2cec7e71989 100644 --- a/app/services/bulk_create_integration_service.rb +++ b/app/services/bulk_create_integration_service.rb @@ -11,6 +11,8 @@ class BulkCreateIntegrationService service_list = ServiceList.new(batch, service_hash, association).to_array Service.transaction do + run_callbacks(batch) if association == 'project' + results = bulk_insert(*service_list) if integration.data_fields_present? @@ -18,8 +20,6 @@ class BulkCreateIntegrationService bulk_insert(*data_list) end - - run_callbacks(batch) if association == 'project' end end @@ -33,17 +33,15 @@ class BulkCreateIntegrationService klass.insert_all(items_to_insert, returning: [:id]) end - # rubocop: disable CodeReuse/ActiveRecord def run_callbacks(batch) - if integration.issue_tracker? - Project.where(id: batch.select(:id)).update_all(has_external_issue_tracker: true) + if integration.issue_tracker? && integration.active? + batch.update_all(has_external_issue_tracker: true) end - if integration.type == 'ExternalWikiService' - Project.where(id: batch.select(:id)).update_all(has_external_wiki: true) + if integration.type == 'ExternalWikiService' && integration.active? + batch.update_all(has_external_wiki: true) end end - # rubocop: enable CodeReuse/ActiveRecord def service_hash if integration.template? |