debian-mirror-gitlab/app/services/issue_links/create_service.rb

32 lines
786 B
Ruby
Raw Normal View History

2020-11-24 15:15:51 +05:30
# frozen_string_literal: true
module IssueLinks
class CreateService < IssuableLinks::CreateService
2022-06-21 17:19:12 +05:30
include IncidentManagement::UsageData
2020-11-24 15:15:51 +05:30
def linkable_issuables(issues)
2023-03-04 22:38:38 +05:30
@linkable_issuables ||= issues.select { |issue| can?(current_user, :admin_issue_link, issue) }
2020-11-24 15:15:51 +05:30
end
def previous_related_issuables
@related_issues ||= issuable.related_issues(current_user).to_a
end
private
2023-07-09 08:55:56 +05:30
def readonly_issuables(issuables)
@readonly_issuables ||= issuables.select { |issuable| issuable.readable_by?(current_user) }
end
2020-11-24 15:15:51 +05:30
def track_event
track_incident_action(current_user, issuable, :incident_relate)
end
2022-05-07 20:08:51 +05:30
def link_class
IssueLink
end
2020-11-24 15:15:51 +05:30
end
end
2021-06-08 01:23:25 +05:30
IssueLinks::CreateService.prepend_mod_with('IssueLinks::CreateService')