Skip to content
Snippets Groups Projects
Commit ad83c308 authored by Alejandro Rodríguez's avatar Alejandro Rodríguez
Browse files

Remove `projects` inclusion in `notes_with_associations` to skip some unnecessary queries

`notes_with_associations` are used for `participant` declarations, but `Participable`
only really cares about the target entity project, and not the participants
projects.

`notes_with_associations` are also used in `Commit::has_been_reverted?` which
employs the reference extractor of the commit, so no references to the notes
projects are made there (`Mentionable::all_references` cares only about the
`author` and other `attr_mentionable`). A paralel situation occurs on
`Issue::referenced_merge_requests`.
parent 722211cd
No related branches found
No related tags found
No related merge requests found
Loading
@@ -198,7 +198,7 @@ class Commit
Loading
@@ -198,7 +198,7 @@ class Commit
end end
   
def notes_with_associations def notes_with_associations
notes.includes(:author, :project) notes.includes(:author)
end end
   
def method_missing(m, *args, &block) def method_missing(m, *args, &block)
Loading
Loading
Loading
@@ -239,7 +239,7 @@ module Issuable
Loading
@@ -239,7 +239,7 @@ module Issuable
end end
   
def notes_with_associations def notes_with_associations
notes.includes(:author, :project) notes.includes(:author)
end end
   
def updated_tasks def updated_tasks
Loading
Loading
Loading
@@ -102,7 +102,7 @@ class Snippet < ActiveRecord::Base
Loading
@@ -102,7 +102,7 @@ class Snippet < ActiveRecord::Base
end end
   
def notes_with_associations def notes_with_associations
notes.includes(:author, :project) notes.includes(:author)
end end
   
class << self class << self
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment