summaryrefslogtreecommitdiff
path: root/lib/gitlab/git/user.rb
diff options
context:
space:
mode:
authorAlejandro Rodríguez <alejorro70@gmail.com>2017-10-23 17:31:05 -0300
committerAlejandro Rodríguez <alejorro70@gmail.com>2017-10-23 17:31:48 -0300
commit4969f486f26e614bb8fb69ed12ad1c14c4cfcd04 (patch)
tree8db7f4dd20c75feb745ed6085548d3137e9561ee /lib/gitlab/git/user.rb
parent743050cede59d4ffbd45f2ed0dc4d7f20b75c6bd (diff)
downloadgitlab-ce-4969f486f26e614bb8fb69ed12ad1c14c4cfcd04.tar.gz
Support `Gitaly::User`'s gl_username fieldgitaly-gl-username
We also unify conversions from and to `Gitaly::User`s in the `Gitlab::Git::User` class.
Diffstat (limited to 'lib/gitlab/git/user.rb')
-rw-r--r--lib/gitlab/git/user.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/gitlab/git/user.rb b/lib/gitlab/git/user.rb
index da74719ae87..e6b61417de1 100644
--- a/lib/gitlab/git/user.rb
+++ b/lib/gitlab/git/user.rb
@@ -7,9 +7,8 @@ module Gitlab
new(gitlab_user.username, gitlab_user.name, gitlab_user.email, Gitlab::GlId.gl_id(gitlab_user))
end
- # TODO support the username field in Gitaly https://gitlab.com/gitlab-org/gitaly/issues/628
def self.from_gitaly(gitaly_user)
- new('', gitaly_user.name, gitaly_user.email, gitaly_user.gl_id)
+ new(gitaly_user.gl_username, gitaly_user.name, gitaly_user.email, gitaly_user.gl_id)
end
def initialize(username, name, email, gl_id)
@@ -22,6 +21,10 @@ module Gitlab
def ==(other)
[username, name, email, gl_id] == [other.username, other.name, other.email, other.gl_id]
end
+
+ def to_gitaly
+ Gitaly::User.new(gl_username: username, gl_id: gl_id, name: name, email: email)
+ end
end
end
end