diff options
author | James Lopez <james@jameslopez.es> | 2017-05-05 18:57:52 +0200 |
---|---|---|
committer | James Lopez <james@jameslopez.es> | 2017-05-05 18:57:52 +0200 |
commit | 856a511b4804a0b78294a29bbba86ac111d960f8 (patch) | |
tree | a6eeba69fcfa386f8b089d9ec8bc3fc11d9ec374 /app/services/projects | |
parent | f15466bd5bd2ce5390e392785d7c750c176acbec (diff) | |
download | gitlab-ce-856a511b4804a0b78294a29bbba86ac111d960f8.tar.gz |
refactor code based on feedbackfix/admin-integrations
Diffstat (limited to 'app/services/projects')
-rw-r--r-- | app/services/projects/propagate_service_template.rb | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/app/services/projects/propagate_service_template.rb b/app/services/projects/propagate_service_template.rb index 2999e1af385..a8ef2108492 100644 --- a/app/services/projects/propagate_service_template.rb +++ b/app/services/projects/propagate_service_template.rb @@ -11,7 +11,7 @@ module Projects end def propagate - return unless @template&.active? + return unless @template.active? Rails.logger.info("Propagating services for template #{@template.id}") @@ -32,11 +32,11 @@ module Projects def bulk_create_from_template(batch) service_list = batch.map do |project_id| - service_hash.merge('project_id' => project_id).values + service_hash.values << project_id end Project.transaction do - bulk_insert_services(service_hash.keys + ['project_id'], service_list) + bulk_insert_services(service_hash.keys << 'project_id', service_list) run_callbacks(batch) end end @@ -75,9 +75,9 @@ module Projects template_hash.each_with_object({}) do |(key, value), service_hash| value = value.is_a?(Hash) ? value.to_json : value - key = Gitlab::Database.postgresql? ? "\"#{key}\"" : "`#{key}`" - service_hash[key] = ActiveRecord::Base.sanitize(value) + service_hash[ActiveRecord::Base.connection.quote_column_name(key)] = + ActiveRecord::Base.sanitize(value) end end end @@ -93,7 +93,7 @@ module Projects end def active_external_issue_tracker? - @template.category == :issue_tracker && !@template.default + @template.issue_tracker? && !@template.default end def active_external_wiki? |