Class: Issuable::DestroyService

Inherits:
IssuableBaseService show all
Defined in:
app/services/issuable/destroy_service.rb

Direct Known Subclasses

Issues::DestroyService

Constant Summary collapse

BATCH_SIZE =
100

Instance Attribute Summary

Attributes inherited from BaseContainerService

#container, #current_user, #group, #params, #project

Instance Method Summary collapse

Methods inherited from IssuableBaseService

constructor_container_arg

Methods inherited from BaseContainerService

#group_container?, #namespace_container?, #project_container?, #project_group, #root_ancestor

Methods included from BaseServiceUtility

#deny_visibility_level, #event_service, #log_error, #log_info, #notification_service, #system_hook_service, #todo_service, #visibility_level

Methods included from Gitlab::Allowable

#can?, #can_all?, #can_any?

Constructor Details

#initialize(container:, current_user: nil, params: {}) ⇒ DestroyService

TODO: this is to be removed once we get to rename the IssuableBaseService project param to container



8
9
10
# File 'app/services/issuable/destroy_service.rb', line 8

def initialize(container:, current_user: nil, params: {})
  super(container: container, current_user: current_user, params: params)
end

Instance Method Details

#execute(issuable) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'app/services/issuable/destroy_service.rb', line 12

def execute(issuable)
  # load sync object before destroy otherwise we cannot access it for
  # deletion of label links in delete_label_links
  @synced_object_to_delete = issuable.try(:sync_object)

  before_destroy(issuable)
  destroy_ci_records(issuable)
  after_destroy(issuable) if issuable.destroy
end