debian-mirror-gitlab/lib/banzai/reference_parser/merge_request_parser.rb

33 lines
933 B
Ruby
Raw Normal View History

2018-12-13 13:39:08 +05:30
# frozen_string_literal: true
module Banzai
module ReferenceParser
2018-03-17 18:26:18 +05:30
class MergeRequestParser < IssuableParser
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,
2019-07-31 22:56:46 +05:30
:assignees,
2017-08-17 22:00:37 +05:30
{
# 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: [
2018-11-20 20:47:30 +05:30
{ namespace: [:owner, :route] },
2017-08-17 22:00:37 +05:30
{ group: [:owners, :group_members] },
:invited_groups,
:project_members,
2018-11-20 20:47:30 +05:30
:project_feature,
:route
2017-08-17 22:00:37 +05:30
]
}),
self.class.data_attribute
)
end
end
end
end