Class: Issues::MoveService

Inherits:
Issuable::Clone::BaseService show all
Defined in:
app/services/issues/move_service.rb

Constant Summary collapse

MoveError =
Class.new(StandardError)

Instance Attribute Summary

Attributes inherited from Issuable::Clone::BaseService

#new_entity, #original_entity

Attributes inherited from BaseService

#current_user, #params, #project

Instance Method Summary collapse

Methods inherited from BaseService

#initialize

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 Method Details

#execute(issue, target_project) ⇒ Object


7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/services/issues/move_service.rb', line 7

def execute(issue, target_project)
  @target_project = target_project

  unless issue.can_move?(current_user, @target_project)
    raise MoveError, s_('MoveIssue|Cannot move issue due to insufficient permissions!')
  end

  if @project == @target_project
    raise MoveError, s_('MoveIssue|Cannot move issue to project it originates from!')
  end

  super

  notify_participants

  # Updates old issue sent notifications allowing
  # to receive service desk emails on the new moved issue.
  update_service_desk_sent_notifications

  new_entity
end