Direct transfer will match incorrect user for activity items
<!--- Please read this! Before opening a new issue, make sure to search for keywords in the issues filtered by the "regression" or "type::bug" label: - https://gitlab.com/gitlab-org/gitlab/issues?label_name%5B%5D=regression - https://gitlab.com/gitlab-org/gitlab/issues?label_name%5B%5D=type::bug and verify the issue you're about to submit isn't a duplicate. ---> ### Summary When using direct transfer, even with otherwise correctly set up user matching, activity items will match unrelated users. ### Steps to reproduce 1. _GitLab.com_ Have two different users: - `User1`, with primary email address `EmailA` - `User2`, with primary email address `EmailB` 2. _Self-managed instance_ Have a user named `User1` with primary/public email address `EmailB` 3. _Self-managed instance_ Let `User1` create an issue and assign to themselves 4. _GitLab.com_ Direct transfer the self-managed group housing the project from step 3 to GitLab.com 5. _GitLab.com_ Observe that: - The issue is assigned correctly: It is assigned to `User2` as per the match on `EmailB` - In the activity history of the issue an item will state that `User2` has assigned the issue to `User1` ### Example Project This issue showcases the behavior: https://gitlab.com/test3390922/export-this/test/-/issues/1 – the activity item says that the issue was assigned to my normal account, `@manuelgrabowski`. The issue is actually (and correctly!) assigned to my admin account `@manuelgrabowski-admin`: ![image](/uploads/47bbec0f5fdccf1f25f1a6ac4c734de4/image.png){width=50%} In my self-hosted test intance, the account has the `@manuelgrabowski` username, but the same public email as the `@manuelgrabowski-admin` account on GitLab.com: ![image](/uploads/ad96b541fd26d9b2e54240e02ba14f56/image.png){width=50%} ### What is the current *bug* behavior? Activity item doesn't match correct user ### What is the expected *correct* behavior? Activity item does match correct user ### Relevant logs and/or screenshots - ### Output of checks This bug happens on GitLab.com #### Results of GitLab environment info The self-managed source instance I reproduced this with is running v16.0.1-ee, [customer](https://gitlab.zendesk.com/agent/tickets/411841) (internal) is experiencing the problem with 15.8.5. #### Results of GitLab application Check - ### Possible fixes -
issue