user.rb 995 B

1234567891011121314151617181920212223242526272829
  1. # Copyright (C) 2012-2023 Zammad Foundation, https://zammad-foundation.org/
  2. class Sequencer::Unit::Import::Freshdesk::Conversation::User < Sequencer::Unit::Import::Freshdesk::SubSequence::Generic
  3. prepend ::Sequencer::Unit::Import::Common::Model::Mixin::Skip::Action
  4. skip_action :skipped, :failed
  5. uses :dry_run, :import_job, :resource, :field_map, :id_map, :skip_initial_contacts
  6. def process
  7. return if !skip_initial_contacts || user_exists? || resource['user_id'].blank?
  8. ::Sequencer.process('Import::Freshdesk::Contact',
  9. parameters: {
  10. import_job: import_job,
  11. dry_run: dry_run,
  12. field_map: field_map,
  13. id_map: id_map,
  14. contact_id: resource['user_id'],
  15. resource: {},
  16. })
  17. end
  18. private
  19. def user_exists?
  20. id_map['User'][resource['user_id']].present?
  21. end
  22. end