gitlab-org--gitlab-foss/spec/services
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_settings
applications
auth Correct Gitlab Capitalization in code files 2018-09-21 12:05:37 +00:00
boards Filter out archived issues from group issue board 2018-09-14 16:12:36 -05:00
chat_names
ci CE Resolve "Refactor code quality similar to JUnit tests" 2018-10-02 17:01:26 +00:00
clusters Do not persist errors from Kubernetes calls 2018-09-17 12:35:42 -05:00
commits Freeze string literals 2018-08-10 18:15:25 +02:00
deploy_keys
deploy_tokens
discussions
emails
events
files Adds chmod action to POST /projects/:id/repository/commits API 2018-09-27 11:51:15 +02:00
gpg_keys
groups Geo: sync disabled wikis. Stage 2 2018-09-25 17:49:39 +03:00
issuable Use ResourceLabelEvent for tracking label changes 2018-09-07 13:39:20 +00:00
issues Use ResourceLabelEvent for tracking label changes 2018-09-07 13:39:20 +00:00
keys
labels
lfs
members Delete todos when users loses target read permissions 2018-07-30 13:29:18 +02:00
merge_requests Remove Gitlab::Git::Repository#rugged and Gollum code 2018-10-02 16:34:28 -03:00
milestones Merge branch 'issue_36138' into 'master' 2018-08-28 07:49:09 +00:00
notes Auto resolve new notes of resolved discussions 2018-09-24 08:30:58 -05:00
projects Create labels_as_hash_ concern, modify params for method 2018-10-03 09:13:42 -07:00
prometheus
protected_branches
protected_tags
quick_actions Allow /copy_metadata for new issues 2018-09-27 11:07:26 +02:00
resource_events Use ResourceLabelEvent for tracking label changes 2018-09-07 13:39:20 +00:00
search
tags
test_hooks
todos/destroy Add changes from the EE 2018-08-06 14:18:21 +02:00
users allow users api to set public_email 2018-10-01 13:24:16 +02:00
wiki_pages
wikis Replace whitespaces in wiki page attachments file names 2018-09-07 14:10:15 +00:00
access_token_validation_service_spec.rb
after_branch_delete_service_spec.rb
base_count_service_spec.rb
cohorts_service_spec.rb
compare_service_spec.rb
create_branch_service_spec.rb
create_deployment_service_spec.rb
create_release_service_spec.rb
create_snippet_service_spec.rb
delete_branch_service_spec.rb
delete_merged_branches_service_spec.rb
event_create_service_spec.rb
git_push_service_spec.rb Resolve "Enable Auto DevOps by default for self managed instances of GitLab" 2018-09-18 19:20:43 +00:00
git_tag_push_service_spec.rb Remove Gitlab::Git::Repository#rugged and Gollum code 2018-10-02 16:34:28 -03:00
gravatar_service_spec.rb
import_export_clean_up_service_spec.rb
note_summary_spec.rb
notification_recipient_service_spec.rb Fix N+1 for notification recipients on private projects 2018-10-04 14:28:15 +01:00
notification_service_spec.rb Automatically disable Auto DevOps for project upon first pipeline failure 2018-09-06 19:20:42 +00:00
preview_markdown_service_spec.rb render using RedCarpet if legacy_render parameter is set 2018-09-05 09:19:16 -05:00
push_event_payload_service_spec.rb
repair_ldap_blocked_user_service_spec.rb
repository_archive_clean_up_service_spec.rb
reset_project_cache_service_spec.rb
search_service_spec.rb
spam_service_spec.rb
submit_usage_ping_service_spec.rb
system_hooks_service_spec.rb
system_note_service_spec.rb Fix SpaceBeforeFirstArg cop 2018-09-20 21:47:34 +05:00
todo_service_spec.rb Whitelist existing destroy_all offenses 2018-08-16 17:29:37 +02:00
update_merge_request_metrics_service_spec.rb
update_release_service_spec.rb
update_snippet_service_spec.rb
upload_service_spec.rb
user_project_access_changed_service_spec.rb
verify_pages_domain_service_spec.rb
web_hook_service_spec.rb