Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-11-30 18:14:19 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-11-30 18:14:19 +0300
commit048f666f8a2ba77e45146845ad280ea1c5460ccd (patch)
tree38a2d1438d6c3bd060a72f889f9c1eaa4e7b79b3 /app/services/users/refresh_authorized_projects_service.rb
parent19c9422e1f3792680aa3f9e6190218b31a838fe3 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services/users/refresh_authorized_projects_service.rb')
-rw-r--r--app/services/users/refresh_authorized_projects_service.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/app/services/users/refresh_authorized_projects_service.rb b/app/services/users/refresh_authorized_projects_service.rb
index 2d9766c3c56..fe61335f3ed 100644
--- a/app/services/users/refresh_authorized_projects_service.rb
+++ b/app/services/users/refresh_authorized_projects_service.rb
@@ -63,12 +63,12 @@ module Users
# Updates the list of authorizations for the current user.
#
# remove - The IDs of the authorization rows to remove.
- # add - Rows to insert in the form `[user id, project id, access level]`
+ # add - Rows to insert in the form `[{ user_id: user_id, project_id: project_id, access_level: access_level}, ...]`
def update_authorizations(remove = [], add = [])
log_refresh_details(remove, add)
- user.remove_project_authorizations(remove) unless remove.empty?
- ProjectAuthorization.insert_authorizations(add) unless add.empty?
+ user.remove_project_authorizations(remove) if remove.any?
+ ProjectAuthorization.insert_all_in_batches(add) if add.any?
# Since we batch insert authorization rows, Rails' associations may get
# out of sync. As such we force a reload of the User object.
@@ -88,7 +88,7 @@ module Users
# most often there's only a few entries in remove and add, but limit it to the first 5
# entries to avoid flooding the logs
'authorized_projects_refresh.rows_deleted_slice': remove.first(5),
- 'authorized_projects_refresh.rows_added_slice': add.first(5))
+ 'authorized_projects_refresh.rows_added_slice': add.first(5).map(&:values))
end
end
end