Skip to content

Add username to users mapper

Carla Drago requested to merge 413623-match-user-activity into master

When importing a group using Direct Transfer we map users on the source instance to those on the destination instance by matching email addresses. Sometimes the @username on the source instance will differ from the one on the destination instance. This poses a problem when importing issue and mr descriptions and system notes that @-mention a user, as we had no way of mapping the source username to the destination username. see #413623 (closed)

The changes here address that problem.

  • updating the get_members graphql query to include the username in the returned result.
  • updating the user_mapper with methods to create and save source_usernames and destination_usernames in a hash in redis.
  • adding a username pipeline for updating all issue/mr/note username mentions with the correct username where necessary.

Screenshots or screen recordings

Before

Screenshot_2023-08-18_at_16.52.17

After

Screenshot_2023-08-18_at_14.17.47

Screenshot_2023-08-18_at_14.18.05

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

  • sign in as a new user on gitlab.com

  • create a group

  • create a project in the group

  • create an issue and assign it to self

  • add your normal gitlab user as a member to the group

  • create a user on gdk.test with the same email address, but a different @username

  • impersonate your normal gitlab member on gdk.test

  • import the group created above from gitlab.com using Direct Transfer

  • observe that the issue author should have the correct first and last name and the @username in the activity notes should have the destination @username.

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 #413623 (closed)

Edited by Carla Drago

Merge request reports