diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-04-07 15:10:39 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-04-07 15:10:39 +0300 |
commit | 4d5e790175cbd85f4b5bb0a9996efde10a9cad65 (patch) | |
tree | da36b26cfdbd9da8eb40e0ea649672242b98c158 /lib/gitlab/legacy_github_import | |
parent | 6c448c743f157c882ace5291aba21208fa6b011b (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/legacy_github_import')
-rw-r--r-- | lib/gitlab/legacy_github_import/user_formatter.rb | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/gitlab/legacy_github_import/user_formatter.rb b/lib/gitlab/legacy_github_import/user_formatter.rb index d45a166d2b7..8fd8354e59c 100644 --- a/lib/gitlab/legacy_github_import/user_formatter.rb +++ b/lib/gitlab/legacy_github_import/user_formatter.rb @@ -5,6 +5,8 @@ module Gitlab class UserFormatter attr_reader :client, :raw + GITEA_GHOST_EMAIL = 'ghost_user@gitea_import_dummy_email.com' + def initialize(client, raw) @client = client @raw = raw @@ -27,7 +29,14 @@ module Gitlab private def email - @email ||= client.user(raw[:login]).to_h[:email] + # Gitea marks deleted users as 'Ghost' users and removes them from + # their system. So for Gitea 'Ghost' users we need to assign a dummy + # email address to avoid querying the Gitea api for a non existing user + if raw[:login] == 'Ghost' && raw[:id] == -1 + @email = GITEA_GHOST_EMAIL + else + @email ||= client.user(raw[:login]).to_h[:email] + end end def find_by_email |