Commit 32875f9aaf2c18e11a0af59e389b37ba520dd584
Exists in
spb-stable
and in
2 other branches
Merge pull request #6937 from chamill/master
Provide fallback for missing `name` value.
Showing
1 changed file
with
5 additions
and
1 deletions
Show diff stats
lib/gitlab/oauth/user.rb
| ... | ... | @@ -65,7 +65,11 @@ module Gitlab |
| 65 | 65 | end |
| 66 | 66 | |
| 67 | 67 | def name |
| 68 | - auth.info.name.to_s.force_encoding("utf-8") | |
| 68 | + if auth.info.name.nil? | |
| 69 | + "#{auth.info.first_name} #{auth.info.last_name}".force_encoding('utf-8') | |
| 70 | + else | |
| 71 | + auth.info.name.to_s.force_encoding('utf-8') | |
| 72 | + end | |
| 69 | 73 | end |
| 70 | 74 | |
| 71 | 75 | def username | ... | ... |