2016-06-16 23:09:34 +05:30
|
|
|
module Banzai
|
|
|
|
module ReferenceParser
|
2018-03-17 18:26:18 +05:30
|
|
|
class MergeRequestParser < IssuableParser
|
2016-06-16 23:09:34 +05:30
|
|
|
self.reference_type = :merge_request
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
def records_for_nodes(nodes)
|
2017-08-17 22:00:37 +05:30
|
|
|
@merge_requests_for_nodes ||= grouped_objects_for_nodes(
|
|
|
|
nodes,
|
|
|
|
MergeRequest.includes(
|
|
|
|
:author,
|
|
|
|
:assignee,
|
|
|
|
{
|
|
|
|
# These associations are primarily used for checking permissions.
|
|
|
|
# Eager loading these ensures we don't end up running dozens of
|
|
|
|
# queries in this process.
|
|
|
|
target_project: [
|
|
|
|
{ namespace: :owner },
|
|
|
|
{ group: [:owners, :group_members] },
|
|
|
|
:invited_groups,
|
|
|
|
:project_members,
|
|
|
|
:project_feature
|
|
|
|
]
|
|
|
|
}),
|
|
|
|
self.class.data_attribute
|
|
|
|
)
|
|
|
|
end
|
2016-06-16 23:09:34 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|