Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorC. Morgan Hamill <chamill@wesleyan.edu>2014-05-08 00:33:54 +0400
committerC. Morgan Hamill <chamill@wesleyan.edu>2014-05-08 00:33:54 +0400
commit9e805b77544df5be602d0c218d7be1047eb6729f (patch)
treed60067d9298394fa42f14ad4ad31433562aaa805 /lib
parent3dea71ce0f8e78d7022ea25312af7c812c777d79 (diff)
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`.
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/oauth/user.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/gitlab/oauth/user.rb b/lib/gitlab/oauth/user.rb
index 1bac93378ef..c6f56c141e5 100644
--- a/lib/gitlab/oauth/user.rb
+++ b/lib/gitlab/oauth/user.rb
@@ -65,7 +65,11 @@ module Gitlab
end
def name
- auth.info.name.to_s.force_encoding("utf-8")
+ unless auth.info.name.nil?
+ auth.info.name.to_s.force_encoding("utf-8")
+ else
+ "#{auth.info.first_name} #{auth.info.last_name}".force_encoding("utf-8")
+ end
end
def username