Class: WorkItems::DataSync::Widgets::Hierarchy
- Inherits:
-
Base
- Object
- Issuable::Callbacks::Base
- Callbacks::Base
- Base
- WorkItems::DataSync::Widgets::Hierarchy
- Defined in:
- app/services/work_items/data_sync/widgets/hierarchy.rb
Constant Summary collapse
- ALLOWED_PARAMS =
%i[parent_work_item_id].freeze
Constants inherited from Base
Constants inherited from Issuable::Callbacks::Base
Issuable::Callbacks::Base::Error
Instance Attribute Summary
Attributes inherited from Base
#current_user, #target_work_item, #work_item
Class Method Summary collapse
Instance Method Summary collapse
-
#after_save_commit ⇒ Object
overriden in EE.
- #post_move_cleanup ⇒ Object
Methods inherited from Base
Methods inherited from Callbacks::Base
Methods inherited from Issuable::Callbacks::Base
#after_create, #after_initialize, #after_save, #after_update, #after_update_commit, #before_create, #before_update, execute_without_params?, #initialize
Methods included from Gitlab::Allowable
Constructor Details
This class inherits a constructor from WorkItems::DataSync::Widgets::Base
Class Method Details
.cleanup_source_work_item_data?(_work_item) ⇒ Boolean
9 10 11 |
# File 'app/services/work_items/data_sync/widgets/hierarchy.rb', line 9 def self.cleanup_source_work_item_data?(_work_item) true end |
Instance Method Details
#after_save_commit ⇒ Object
overriden in EE
14 15 16 17 18 19 20 21 22 23 |
# File 'app/services/work_items/data_sync/widgets/hierarchy.rb', line 14 def after_save_commit return unless target_work_item.(:hierarchy) handle_parent # we only handle child items for `move` functionality, `clone` does not copy child items. return unless params[:operation] == :move handle_children end |
#post_move_cleanup ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 |
# File 'app/services/work_items/data_sync/widgets/hierarchy.rb', line 25 def post_move_cleanup # cleanup parent link remove_parent_link_from_work_item return unless self.class.superclass.cleanup_source_work_item_data?(work_item) # Cleanup children linked to moved item when that is an issue because we are currently creating those # child items in the destination namespace anyway. If we decide to relink child items for Issue WIT # then we should not be deleting them here. work_item.child_links.each { |child_link| child_link.work_item.destroy! } if work_item.work_item_type.issue? end |