2022-01-01 13:38:12 +00:00
|
|
|
# Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
|
2021-06-01 12:20:20 +00:00
|
|
|
|
2017-08-14 11:56:23 +00:00
|
|
|
class Sequencer
|
|
|
|
class Unit
|
|
|
|
module Exchange
|
|
|
|
module Folders
|
|
|
|
class IdPathMap < Sequencer::Unit::Base
|
2017-09-15 10:55:49 +00:00
|
|
|
include ::Sequencer::Unit::Exchange::Folders::Mixin::Folder
|
2017-08-14 11:56:23 +00:00
|
|
|
|
2020-03-18 09:56:37 +00:00
|
|
|
optional :ews_folder_ids
|
2017-08-14 11:56:23 +00:00
|
|
|
provides :ews_folder_id_path_map
|
|
|
|
|
|
|
|
def process
|
|
|
|
state.provide(:ews_folder_id_path_map) do
|
|
|
|
|
2020-03-18 09:56:37 +00:00
|
|
|
ids = ews_folder_ids
|
2017-08-14 11:56:23 +00:00
|
|
|
ids ||= []
|
|
|
|
|
2021-06-24 07:05:39 +00:00
|
|
|
ews_folder.id_folder_map.filter_map do |id, folder|
|
2017-08-14 11:56:23 +00:00
|
|
|
next if ids.present? && ids.exclude?(id)
|
|
|
|
next if folder.total_count.blank?
|
|
|
|
next if folder.total_count.zero?
|
|
|
|
|
|
|
|
[id, ews_folder.display_path(folder)]
|
2021-06-24 07:05:39 +00:00
|
|
|
end.to_h
|
2017-08-14 11:56:23 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|