2020-08-20 20:10:44 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module IssueLinks
|
|
|
|
class CreateService < IssuableLinks::CreateService
|
2022-03-22 08:07:28 -04:00
|
|
|
include IncidentManagement::UsageData
|
|
|
|
|
2020-08-20 20:10:44 -04:00
|
|
|
def linkable_issuables(issues)
|
|
|
|
@linkable_issuables ||= begin
|
|
|
|
issues.select { |issue| can?(current_user, :admin_issue_link, issue) }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def previous_related_issuables
|
|
|
|
@related_issues ||= issuable.related_issues(current_user).to_a
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
2020-09-10 17:08:28 -04:00
|
|
|
def track_event
|
|
|
|
track_incident_action(current_user, issuable, :incident_relate)
|
|
|
|
end
|
2022-03-15 08:07:44 -04:00
|
|
|
|
|
|
|
def link_class
|
|
|
|
IssueLink
|
|
|
|
end
|
2020-08-20 20:10:44 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2021-05-11 17:10:21 -04:00
|
|
|
IssueLinks::CreateService.prepend_mod_with('IssueLinks::CreateService')
|