gitlab-org--gitlab-foss/spec
Sean McGivern 28e6af88aa Fix N+1 for notification recipients on private projects
If we don't call #to_a, we're relying on the members already being loaded from
elsewhere. Otherwise we'll do a separate query for each user:

    [1] pry(main)> Project.first.team.members.include?(User.first)
      Project Load (0.7ms)  SELECT  "projects".* FROM "projects"  ORDER BY "projects"."id" ASC LIMIT 1
      ↳ (pry):3
      User Load (1.8ms)  SELECT  "users".* FROM "users"  ORDER BY "users"."id" ASC LIMIT 1
      ↳ (pry):3
      User Exists (0.6ms)  SELECT  1 AS one FROM "users" INNER JOIN "project_authorizations" ON "users"."id" = "project_authorizations"."user_id" WHERE "project_authorizations"."project_id" = $1 AND "users"."id" = $2 LIMIT 1  [["project_id", 1], ["id", 1]]
      ↳ (pry):3
    => true
    [2] pry(main)> Project.first.team.members.to_a.include?(User.first)
      Project Load (12.8ms)  SELECT  "projects".* FROM "projects"  ORDER BY "projects"."id" ASC LIMIT 1
      ↳ (pry):1
      User Load (9.6ms)  SELECT "users".* FROM "users" INNER JOIN "project_authorizations" ON "users"."id" = "project_authorizations"."user_id" WHERE "project_authorizations"."project_id" = $1  [["project_id", 1]]
      ↳ (pry):1
      User Load (0.6ms)  SELECT  "users".* FROM "users"  ORDER BY "users"."id" ASC LIMIT 1
      ↳ (pry):1
    => true
2018-10-04 14:28:15 +01:00
..
bin Include private contributions in user contribution graph 2018-09-07 15:08:55 +00:00
config Enable omniauth by default 2018-09-13 13:44:04 +01:00
controllers Simplify runner registration token resetting 2018-10-04 08:37:01 +02:00
db Use Rails.root for CommonMetricsImporter 2018-09-11 17:40:32 +02:00
dependencies
factories Merge branch 'fix-todo-cops' into 'master' 2018-10-04 10:17:43 +00:00
features Renders empty states in the Vue app in Job page 2018-10-04 12:59:57 +00:00
finders Allow Gitaly N+1s in MR finder spec 2018-10-04 10:40:16 +01:00
fixtures Merge branch '52195-backport-removal-of-additionalproperties-false-runners-schema' into 'master' 2018-10-04 12:24:16 +00:00
graphql
helpers Fix Error 500 when forking projects with Gravatar disabled 2018-09-28 07:39:58 -04:00
initializers
javascripts Renders empty states in the Vue app in Job page 2018-10-04 12:59:57 +00:00
lib Merge branch 'fix-todo-cops' into 'master' 2018-10-04 10:17:43 +00:00
mailers Automatically disable Auto DevOps for project upon first pipeline failure 2018-09-06 19:20:42 +00:00
migrations Remove orphaned label links 2018-09-07 07:38:44 -07:00
models Merge branch 'ce-7287-epic-references' into 'master' 2018-10-04 12:33:25 +00:00
policies Hides Close MR button on merged MR 2018-10-02 16:17:55 +02:00
presenters Extend reports to support security features 2018-09-27 21:15:08 +00:00
requests Includes commit stats in POST project commits API 2018-10-03 18:11:42 +02:00
routing Fix SpaceBeforeFirstArg cop 2018-09-20 21:47:34 +05:00
rubocop Applies the CE backport of EE#657 2018-09-24 12:02:01 +01:00
serializers Add pipeline status to diffs/commit_item 2018-10-03 13:18:21 -05:00
services Fix N+1 for notification recipients on private projects 2018-10-04 14:28:15 +01:00
sidekiq/cron
support Merge branch '51009-remove-rbac-clusters-feature-flag' into 'master' 2018-10-04 09:19:17 +00:00
tasks Geo: sync disabled wikis. Stage 2 2018-09-25 17:49:39 +03:00
unicorn
uploaders Merge branch 'fix-namespace-upload' into 'master' 2018-09-11 14:42:35 +00:00
validators Allow UrlValidator to work with attr_encrypted 2018-09-17 19:34:40 +01:00
views Uses Vue app to render part of job show page 2018-10-03 15:29:07 +00:00
workers Remove Gitlab::Git::Repository#rugged and Gollum code 2018-10-02 16:34:28 -03:00
factories_spec.rb
fast_spec_helper.rb
rails_helper.rb
rake_helper.rb
simplecov_env.rb
spec_helper.rb Ensure in-memory application settings are cleared before each test 2018-09-10 11:48:09 +02:00