2022-07-13 12:09:54 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module WorkItems
|
|
|
|
module ParentLinks
|
|
|
|
class DestroyService < IssuableLinks::DestroyService
|
|
|
|
attr_reader :link, :current_user, :parent, :child
|
|
|
|
|
|
|
|
def initialize(link, user)
|
|
|
|
@link = link
|
|
|
|
@current_user = user
|
|
|
|
@parent = link.work_item_parent
|
|
|
|
@child = link.work_item
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def create_notes
|
2022-07-20 15:08:38 +00:00
|
|
|
SystemNoteService.unrelate_work_item(parent, child, current_user)
|
2022-07-13 12:09:54 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def not_found_message
|
|
|
|
_('No Work Item Link found')
|
|
|
|
end
|
|
|
|
|
|
|
|
def permission_to_remove_relation?
|
2022-07-15 15:15:01 +00:00
|
|
|
can?(current_user, :admin_parent_link, child) && can?(current_user, :admin_parent_link, parent)
|
2022-07-13 12:09:54 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|