Follow-up - #1161 - Zendesk import fails for deleted tickets.
This commit is contained in:
parent
371a4638ec
commit
f1f93b773e
3 changed files with 30 additions and 1 deletions
|
@ -6,6 +6,7 @@ class Sequencer
|
|||
|
||||
def self.sequence
|
||||
[
|
||||
'Import::Zendesk::Ticket::Skip::Deleted',
|
||||
'Import::Zendesk::Ticket::UserID',
|
||||
'Import::Zendesk::Ticket::OwnerID',
|
||||
'Import::Zendesk::Ticket::GroupID',
|
||||
|
|
|
@ -6,7 +6,12 @@ class Sequencer
|
|||
class SubObject < Sequencer::Unit::Base
|
||||
include ::Sequencer::Unit::Import::Zendesk::SubSequence::Base
|
||||
|
||||
uses :resource, :instance, :user_id, :model_class
|
||||
uses :resource, :instance, :user_id, :model_class, :action
|
||||
|
||||
def self.inherited(subclass)
|
||||
subclass.prepend(::Sequencer::Unit::Import::Common::Model::Mixin::Skip::Action)
|
||||
subclass.skip_action(:skipped, :failed)
|
||||
end
|
||||
|
||||
def process
|
||||
resource_iteration do |sub_resource|
|
||||
|
|
23
lib/sequencer/unit/import/zendesk/ticket/skip/deleted.rb
Normal file
23
lib/sequencer/unit/import/zendesk/ticket/skip/deleted.rb
Normal file
|
@ -0,0 +1,23 @@
|
|||
class Sequencer
|
||||
class Unit
|
||||
module Import
|
||||
module Zendesk
|
||||
module Ticket
|
||||
module Skip
|
||||
class Deleted < Sequencer::Unit::Base
|
||||
|
||||
uses :resource
|
||||
provides :action
|
||||
|
||||
def process
|
||||
return if resource.status != 'deleted'
|
||||
|
||||
state.provide(:action, :skipped)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue