Class: Banzai::ReferenceParser::MergeRequestParser

Inherits:
IssuableParser show all
Defined in:
lib/banzai/reference_parser/merge_request_parser.rb

Instance Method Summary collapse

Methods inherited from IssuableParser

#can_read_reference?, #nodes_visible_to_user, #referenced_by

Methods inherited from BaseParser

#can?, #collection_cache_key, #collection_objects_for_ids, data_attribute, #find_projects_for_hash_keys, #gather_attributes_per_project, #gather_references, #grouped_objects_for_nodes, #initialize, #nodes_user_can_reference, #nodes_visible_to_user, #process, #project_for_node, #projects_for_nodes, #referenced_by, #references_relation, #unique_attribute_values

Constructor Details

This class inherits a constructor from Banzai::ReferenceParser::BaseParser

Instance Method Details

#records_for_nodes(nodes) ⇒ Object


8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/banzai/reference_parser/merge_request_parser.rb', line 8

def records_for_nodes(nodes)
  @merge_requests_for_nodes ||= grouped_objects_for_nodes(
    nodes,
    MergeRequest.includes(
      :author,
      :assignees,
      {
        # 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, :route] },
          { group: [:owners, :group_members] },
          :invited_groups,
          :project_members,
          :project_feature,
          :route
        ]
      }),
    self.class.data_attribute
  )
end