2016-05-26 11:16:43 +00:00
|
|
|
module Banzai
|
|
|
|
module ReferenceParser
|
|
|
|
class MergeRequestParser < BaseParser
|
|
|
|
self.reference_type = :merge_request
|
|
|
|
|
2016-08-24 17:11:48 +00:00
|
|
|
def merge_requests_for_nodes(nodes)
|
|
|
|
@merge_requests_for_nodes ||= grouped_objects_for_nodes(
|
|
|
|
nodes,
|
|
|
|
MergeRequest.all,
|
|
|
|
self.class.data_attribute
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
2016-05-26 11:16:43 +00:00
|
|
|
def references_relation
|
|
|
|
MergeRequest.includes(:author, :assignee, :target_project)
|
|
|
|
end
|
2016-11-01 20:18:51 +00:00
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def can_read_reference?(user, ref_project)
|
|
|
|
can?(user, :read_merge_request, ref_project)
|
|
|
|
end
|
2016-05-26 11:16:43 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|