Commit 9e805b77544df5be602d0c218d7be1047eb6729f
1 parent
3dea71ce
Exists in
spb-stable
and in
2 other branches
Provide fallback for missing `name` value.
If `auth.info.name` is `nil`, then use `auth.info.first_name + auth.info.last_name` as the value of `name`.
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 | + unless auth.info.name.nil? | |
| 69 | + auth.info.name.to_s.force_encoding("utf-8") | |
| 70 | + else | |
| 71 | + "#{auth.info.first_name} #{auth.info.last_name}".force_encoding("utf-8") | |
| 72 | + end | |
| 69 | 73 | end |
| 70 | 74 | |
| 71 | 75 | def username | ... | ... |