gitlab-org--gitlab-foss/app/policies
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
..
application_setting Disable existing offenses for the CodeReuse cops 2018-09-11 17:32:00 +02:00
ci Disable existing offenses for the CodeReuse cops 2018-09-11 17:32:00 +02:00
clusters Enable frozen string in presenters and policies 2018-07-24 13:18:25 -07:00
concerns Rename the module and add a simple test to check 2018-07-27 17:52:45 +08:00
project_policy Enable frozen string in presenters and policies 2018-07-24 13:18:25 -07:00
base_policy.rb Enable frozen string in presenters and policies 2018-07-24 13:18:25 -07:00
commit_policy.rb Freeze string literals 2018-08-10 18:15:25 +02:00
commit_status_policy.rb Enable frozen string in presenters and policies 2018-07-24 13:18:25 -07:00
deploy_key_policy.rb Disable existing offenses for the CodeReuse cops 2018-09-11 17:32:00 +02:00
deploy_token_policy.rb Enable frozen string in presenters and policies 2018-07-24 13:18:25 -07:00
deployment_policy.rb Enable frozen string in presenters and policies 2018-07-24 13:18:25 -07:00
environment_policy.rb Enable frozen string in presenters and policies 2018-07-24 13:18:25 -07:00
external_issue_policy.rb Enable frozen string in presenters and policies 2018-07-24 13:18:25 -07:00
global_policy.rb Spec instance statistics 2018-07-27 15:54:28 +02:00
group_label_policy.rb Enable frozen string in presenters and policies 2018-07-24 13:18:25 -07:00
group_member_policy.rb Enable frozen string in presenters and policies 2018-07-24 13:18:25 -07:00
group_policy.rb Merge branch 'fldubois/gitlab-ce-fix-api-group-createdat' into 'master' 2018-08-28 09:59:34 +00:00
issuable_policy.rb Restrict reopening locked issues for issue authors 2018-09-04 12:25:18 +02:00
issue_policy.rb Restrict reopening locked issues for issue authors 2018-09-04 12:25:18 +02:00
merge_request_policy.rb Enable frozen string in presenters and policies 2018-07-24 13:18:25 -07:00
namespace_policy.rb Enable frozen string in presenters and policies 2018-07-24 13:18:25 -07:00
nil_policy.rb Enable frozen string in presenters and policies 2018-07-24 13:18:25 -07:00
note_policy.rb Enable frozen string in presenters and policies 2018-07-24 13:18:25 -07:00
personal_snippet_policy.rb Enable frozen string in presenters and policies 2018-07-24 13:18:25 -07:00
project_label_policy.rb Enable frozen string in presenters and policies 2018-07-24 13:18:25 -07:00
project_member_policy.rb Enable frozen string in presenters and policies 2018-07-24 13:18:25 -07:00
project_policy.rb Fix N+1 for notification recipients on private projects 2018-10-04 14:28:15 +01:00
project_snippet_policy.rb Enable frozen string in presenters and policies 2018-07-24 13:18:25 -07:00
protected_branch_policy.rb Enable frozen string in presenters and policies 2018-07-24 13:18:25 -07:00
user_policy.rb Allow users to set a status 2018-07-30 15:01:26 +02:00