summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGitLab <example@example.com>2015-07-28 18:04:57 +0200
committerGitLab <example@example.com>2015-07-28 18:04:57 +0200
commit16dcf356b5afe351a78ac976db30e4999600b13b (patch)
tree52f7c820764c8e79188221f2e9fa84eb80b68750 /lib
parent6912f21e5c9dd812286fce156534ebc094466e17 (diff)
downloadgitlab-ce-16dcf356b5afe351a78ac976db30e4999600b13b.tar.gz
Fix style points
To make Rubocop and Douwe happy
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/backend/grack_auth.rb8
-rw-r--r--lib/gitlab/backend/shell_env.rb7
2 files changed, 7 insertions, 8 deletions
diff --git a/lib/gitlab/backend/grack_auth.rb b/lib/gitlab/backend/grack_auth.rb
index e8cb0c77fb4..12292f614e9 100644
--- a/lib/gitlab/backend/grack_auth.rb
+++ b/lib/gitlab/backend/grack_auth.rb
@@ -180,13 +180,7 @@ module Grack
end
def render_grack_auth_ok
- if @user.present?
- gl_id = Gitlab::ShellEnv.gl_id(@user)
- else
- gl_id = ''
- end
-
- [200, { "Content-Type" => "application/json" }, [JSON.dump({'GL_ID' => gl_id})]]
+ [200, { "Content-Type" => "application/json" }, [JSON.dump({ 'GL_ID' => Gitlab::ShellEnv.gl_id(@user) })]]
end
def render_not_found
diff --git a/lib/gitlab/backend/shell_env.rb b/lib/gitlab/backend/shell_env.rb
index 009a3ec1a4b..9f5adee594a 100644
--- a/lib/gitlab/backend/shell_env.rb
+++ b/lib/gitlab/backend/shell_env.rb
@@ -17,7 +17,12 @@ module Gitlab
end
def gl_id(user)
- "user-#{user.id}"
+ if user.present?
+ "user-#{user.id}"
+ else
+ # This empty string is used in the render_grack_auth_ok method
+ ""
+ end
end
end
end