Class: WorkItems::DataSync::Widgets::AwardEmoji

Inherits:
Base show all
Defined in:
app/services/work_items/data_sync/widgets/award_emoji.rb

Constant Summary

Constants inherited from Base

Base::BATCH_SIZE

Constants inherited from Issuable::Callbacks::Base

Issuable::Callbacks::Base::Error

Instance Attribute Summary

Attributes inherited from Base

#current_user, #target_work_item, #work_item

Instance Method Summary collapse

Methods inherited from Base

#initialize

Methods inherited from Callbacks::Base

#raise_error

Methods inherited from Issuable::Callbacks::Base

#after_initialize, #after_save, #after_save_commit, #after_update, #after_update_commit, #before_create, #before_update, #initialize

Methods included from Gitlab::Allowable

#can?, #can_all?, #can_any?

Constructor Details

This class inherits a constructor from WorkItems::DataSync::Widgets::Base

Instance Method Details

#after_createObject



7
8
9
10
11
12
13
14
# File 'app/services/work_items/data_sync/widgets/award_emoji.rb', line 7

def after_create
  return unless params[:operation] == :move
  return unless target_work_item.get_widget(:award_emoji)

  work_item.award_emoji.each_batch(of: BATCH_SIZE) do |awards_batch|
    ::AwardEmoji.insert_all(new_work_item_award_emoji(awards_batch))
  end
end

#post_move_cleanupObject



16
17
18
19
20
# File 'app/services/work_items/data_sync/widgets/award_emoji.rb', line 16

def post_move_cleanup
  work_item.award_emoji.each_batch(of: BATCH_SIZE) do |award_emoji_batch|
    award_emoji_batch.delete_all
  end
end