Class: Issuable::Clone::BaseService

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

Direct Known Subclasses

Issues::CloneService, Issues::MoveService

Instance Attribute Summary collapse

Attributes inherited from BaseContainerService

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

Instance Method Summary collapse

Methods inherited from BaseContainerService

#group_container?, #initialize, #namespace_container?, #project_container?, #project_group

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?

Instance Attribute Details

#new_entityObject (readonly)

Returns the value of attribute new_entity.



6
7
8
# File 'app/services/issuable/clone/base_service.rb', line 6

def new_entity
  @new_entity
end

#original_entityObject (readonly)

Returns the value of attribute original_entity.



6
7
8
# File 'app/services/issuable/clone/base_service.rb', line 6

def original_entity
  @original_entity
end

Instance Method Details

#execute(original_entity, target_parent) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'app/services/issuable/clone/base_service.rb', line 10

def execute(original_entity, target_parent)
  @original_entity = original_entity
  @target_parent = target_parent

  # Using transaction because of a high resources footprint
  # on rewriting notes (unfolding references)
  #
  ApplicationRecord.transaction do
    @new_entity = create_new_entity
    @new_entity.system_note_timestamp = nil

    update_new_entity
    update_old_entity
    create_notes
  end
end