Fix role updates in the direct members role drawer

What does this MR do and why?

On a project's members page, changing a member's role from the "Direct members" tab using the role details drawer shows a "Role was successfully updated." message and displays the new role. After refreshing the page, though, the old role is back. Changing a role the same way from the "Members" tab works fine.

The drawer builds its update request in callRoleUpdateApi, in app/assets/javascripts/members/components/table/drawer/utils.js. It picks the request parameter name from a lookup table, ACCESS_LEVEL_PROPERTY_NAME, keyed by tab type. That table had entries for the user, group, and accessRequest tabs, but not for directMembers, so a role change from that tab sent an undefined parameter name instead of access_level. The backend only accepts known parameters, so it silently dropped the bad one, saved nothing, and still returned success. The drawer then optimistically showed the new role until the next page load restored the real, unchanged one. This MR adds the missing directMembers entry so the drawer sends access_level like the other tabs.

References

The "Direct members" tab was added in !240021 (merged).

Screenshots or screen recordings

How to set up and validate locally

  1. Start GDK with GitLab EE. The role details drawer is enabled by the show_role_details_in_drawer feature flag, which only EE controllers push to the frontend.
  2. Visit a project's members page on the Direct members tab, for example http://gdk.test:3000/<namespace>/<project>/-/project_members?tab=direct_members.
  3. In the row of a direct member who is not the Owner, click their role name (for example "Developer") to open the "Role details" drawer.
  4. In the drawer, pick a different role from the role dropdown.
  5. Optional: open the browser's network tab so you can inspect the next request.
  6. Click "Update role" to save. Confirm the "Role was successfully updated." message and the new role appear. If you opened the network tab, check that the request body contains access_level (not undefined).
  7. Refresh the page and confirm the new role is still there. Before this MR, the page would show the old role again.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Xingli Wu

Merge request reports

Loading
Loading