diff options
Diffstat (limited to 'app/services/issuable/destroy_service.rb')
-rw-r--r-- | app/services/issuable/destroy_service.rb | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/app/services/issuable/destroy_service.rb b/app/services/issuable/destroy_service.rb index d5aa84d8d6c..b75905fb5b0 100644 --- a/app/services/issuable/destroy_service.rb +++ b/app/services/issuable/destroy_service.rb @@ -3,15 +3,13 @@ module Issuable class DestroyService < IssuableBaseService def execute(issuable) - if issuable.destroy - after_destroy(issuable) - end + after_destroy(issuable) if issuable.destroy end private def after_destroy(issuable) - delete_todos(issuable) + delete_associated_records(issuable) issuable.update_project_counter_caches issuable.assignees.each(&:invalidate_cache_counts) end @@ -20,19 +18,23 @@ module Issuable issuable.resource_parent.group end - def delete_todos(issuable) + def delete_associated_records(issuable) actor = group_for(issuable) - if Feature.enabled?(:destroy_issuable_todos_async, actor, default_enabled: :yaml) - TodosDestroyer::DestroyedIssuableWorker - .perform_async(issuable.id, issuable.class.name) - else - TodosDestroyer::DestroyedIssuableWorker - .new - .perform(issuable.id, issuable.class.name) - end + delete_todos(actor, issuable) + delete_label_links(actor, issuable) + end + + def delete_todos(actor, issuable) + TodosDestroyer::DestroyedIssuableWorker + .perform_async(issuable.id, issuable.class.name) + end + + def delete_label_links(actor, issuable) + Issuable::LabelLinksDestroyWorker + .perform_async(issuable.id, issuable.class.name) end end end -Issuable::DestroyService.prepend_if_ee('EE::Issuable::DestroyService') +Issuable::DestroyService.prepend_mod_with('Issuable::DestroyService') |