From 702b792eb9475f01d9350c932be715d3a986a7d3 Mon Sep 17 00:00:00 2001 From: Thorsten Eckel Date: Mon, 8 Jan 2018 16:22:06 +0100 Subject: [PATCH] Refactoring: Improved ExternalSync source name for Exchange. --- ...8000001_change_exchange_external_sync_identifier.rb | 10 ++++++++++ .../exchange/folder_contact/static_attributes.rb | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20180108000001_change_exchange_external_sync_identifier.rb diff --git a/db/migrate/20180108000001_change_exchange_external_sync_identifier.rb b/db/migrate/20180108000001_change_exchange_external_sync_identifier.rb new file mode 100644 index 000000000..7e49a6213 --- /dev/null +++ b/db/migrate/20180108000001_change_exchange_external_sync_identifier.rb @@ -0,0 +1,10 @@ +class ChangeExchangeExternalSyncIdentifier < ActiveRecord::Migration[5.1] + def up + # return if it's a new setup to avoid running the migration + return if !Setting.find_by(name: 'system_init_done') + + # rubocop:disable Rails/SkipsModelValidations + ExternalSync.where(source: 'EWS::FolderContact').update_all(source: 'Exchange::FolderContact') + end + +end diff --git a/lib/sequencer/unit/import/exchange/folder_contact/static_attributes.rb b/lib/sequencer/unit/import/exchange/folder_contact/static_attributes.rb index e7e22e026..ec31b8abd 100644 --- a/lib/sequencer/unit/import/exchange/folder_contact/static_attributes.rb +++ b/lib/sequencer/unit/import/exchange/folder_contact/static_attributes.rb @@ -9,7 +9,7 @@ class Sequencer def process state.provide(:model_class, ::User) - state.provide(:external_sync_source, 'EWS::FolderContact') + state.provide(:external_sync_source, 'Exchange::FolderContact') end end end