id_path_map.rb 657 B

123456789101112131415161718192021222324
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. class Sequencer::Unit::Exchange::Folders::IdPathMap < Sequencer::Unit::Base
  3. include ::Sequencer::Unit::Exchange::Folders::Mixin::Folder
  4. optional :ews_folder_ids
  5. provides :ews_folder_id_path_map
  6. def process
  7. state.provide(:ews_folder_id_path_map) do
  8. ids = ews_folder_ids
  9. ids ||= []
  10. ews_folder.id_folder_map.filter_map do |id, folder|
  11. next if ids.present? && ids.exclude?(id)
  12. next if folder.total_count.blank?
  13. next if folder.total_count.zero?
  14. [id, ews_folder.display_path(folder)]
  15. end.to_h
  16. end
  17. end
  18. end