Class: Issuable::Clone::BaseService

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

Instance Attribute Summary collapse

Attributes inherited from BaseProjectService

#project

Attributes inherited from BaseContainerService

#container, #current_user, #params

Instance Method Summary collapse

Methods inherited from BaseProjectService

#initialize

Methods included from Gitlab::Utils::StrongMemoize

#clear_memoization, #strong_memoize, #strong_memoized?

Methods inherited from BaseContainerService

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

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

#target_projectObject (readonly)

Returns the value of attribute target_project.


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

def target_project
  @target_project
end

Instance Method Details

#execute(original_entity, target_project = nil) ⇒ Object


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

def execute(original_entity, target_project = nil)
  @original_entity = original_entity
  @target_project = target_project

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

    update_new_entity
    update_old_entity
    create_notes
  end
end