Skip to content

Refactor Members::UpdateService to update multiple members

What does this MR do and why?

To add a new GraphQL mutation to update multiple group members in a single request the Members::UpdateService is refactored.

The updates are wrapped in a transaction. We call the update! method only when the params change the expiry or the access level of the member. post_update method is not called inside the transaction as we do some things in post_update like adding work to a Sidekiq queue which doesn't automatically get rolled back if there's an error. Also, we only need to generate audit events (generated by after_execute) when there's a change, for this, we use filter_map with next.

Summary of changes

MR You are here
Refactor Members::UpdateService to enable updating multiple members in a single call 👈
Add a GraphQL mutation for updating multiple group members !96763 (merged)

How to set up and validate locally

  1. Go to the group members page: http://localhost:3000/groups/<your-group>/-/group_members
  2. Update any member role and it should get updated for all the projects in the group.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #354749 (closed)

Edited by Abdul Wadood

Merge request reports