diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-07-20 09:55:51 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-07-20 09:55:51 +0000 |
commit | e8d2c2579383897a1dd7f9debd359abe8ae8373d (patch) | |
tree | c42be41678c2586d49a75cabce89322082698334 /lib/gitlab/git/user.rb | |
parent | fc845b37ec3a90aaa719975f607740c22ba6a113 (diff) | |
download | gitlab-ce-e8d2c2579383897a1dd7f9debd359abe8ae8373d.tar.gz |
Add latest changes from gitlab-org/gitlab@14-1-stable-eev14.1.0-rc42
Diffstat (limited to 'lib/gitlab/git/user.rb')
-rw-r--r-- | lib/gitlab/git/user.rb | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/lib/gitlab/git/user.rb b/lib/gitlab/git/user.rb index 2c798844798..05ae3391040 100644 --- a/lib/gitlab/git/user.rb +++ b/lib/gitlab/git/user.rb @@ -3,10 +3,10 @@ module Gitlab module Git class User - attr_reader :username, :name, :email, :gl_id + attr_reader :username, :name, :email, :gl_id, :timezone def self.from_gitlab(gitlab_user) - new(gitlab_user.username, gitlab_user.name, gitlab_user.commit_email, Gitlab::GlId.gl_id(gitlab_user)) + new(gitlab_user.username, gitlab_user.name, gitlab_user.commit_email, Gitlab::GlId.gl_id(gitlab_user), gitlab_user.timezone) end def self.from_gitaly(gitaly_user) @@ -14,23 +14,30 @@ module Gitlab gitaly_user.gl_username, Gitlab::EncodingHelper.encode!(gitaly_user.name), Gitlab::EncodingHelper.encode!(gitaly_user.email), - gitaly_user.gl_id + gitaly_user.gl_id, + gitaly_user.timezone ) end - def initialize(username, name, email, gl_id) + def initialize(username, name, email, gl_id, timezone) @username = username @name = name @email = email @gl_id = gl_id + + @timezone = if Feature.enabled?(:add_timezone_to_web_operations) + timezone + else + Time.zone.tzinfo.name + end end def ==(other) - [username, name, email, gl_id] == [other.username, other.name, other.email, other.gl_id] + [username, name, email, gl_id, timezone] == [other.username, other.name, other.email, other.gl_id, other.timezone] end def to_gitaly - Gitaly::User.new(gl_username: username, gl_id: gl_id, name: name.b, email: email.b) + Gitaly::User.new(gl_username: username, gl_id: gl_id, name: name.b, email: email.b, timezone: timezone) end end end |