diff options
Diffstat (limited to 'app/services/authorized_project_update/project_group_link_create_service.rb')
-rw-r--r-- | app/services/authorized_project_update/project_group_link_create_service.rb | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/app/services/authorized_project_update/project_group_link_create_service.rb b/app/services/authorized_project_update/project_group_link_create_service.rb index e9e7c56d7c7..10cf4c50569 100644 --- a/app/services/authorized_project_update/project_group_link_create_service.rb +++ b/app/services/authorized_project_update/project_group_link_create_service.rb @@ -65,16 +65,8 @@ module AuthorizedProjectUpdate end def update_authorizations(user_ids_to_delete, authorizations_to_create) - ProjectAuthorization.transaction do - if user_ids_to_delete.any? - ProjectAuthorization.where(project_id: project.id, user_id: user_ids_to_delete) # rubocop: disable CodeReuse/ActiveRecord - .delete_all - end - - if authorizations_to_create.any? - ProjectAuthorization.insert_all(authorizations_to_create) - end - end + project.remove_project_authorizations(user_ids_to_delete) if user_ids_to_delete.any? + ProjectAuthorization.insert_all_in_batches(authorizations_to_create) if authorizations_to_create.any? end end end |