Fix SQL error when sorting 2FA-enabled users by name in admin area
What does this MR do?
Change User.with_two_factor
to make it work without DISTINCT and avoid duplicates of JOIN
What are the relevant issue numbers?
https://gitlab.com/gitlab-org/gitlab-ce/issues/50491
Does this MR meet the acceptance criteria?
-
Changelog entry added, if necessary -
Documentation created/updated -
Tests added for this feature/bug -
Conforms to the code review guidelines -
Conforms to the merge request performance guidelines -
Conforms to the style guides -
Conforms to the database guides