diff options
Diffstat (limited to 'lib/gitlab_shell.rb')
-rw-r--r-- | lib/gitlab_shell.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/gitlab_shell.rb b/lib/gitlab_shell.rb index 0221624..9644cf4 100644 --- a/lib/gitlab_shell.rb +++ b/lib/gitlab_shell.rb @@ -196,8 +196,14 @@ class GitlabShell # rubocop:disable Metrics/ClassLength end end + def username_from_discover + return nil unless user && user['username'] + + "@#{user['username']}" + end + def username - @username ||= user && user['username'] || 'Anonymous' + @username ||= username_from_discover || 'Anonymous' end # User identifier to be used in log messages. |