diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-20 23:50:22 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-20 23:50:22 +0000 |
commit | 9dc93a4519d9d5d7be48ff274127136236a3adb3 (patch) | |
tree | 70467ae3692a0e35e5ea56bcb803eb512a10bedb /app/models/commit.rb | |
parent | 4b0f34b6d759d6299322b3a54453e930c6121ff0 (diff) | |
download | gitlab-ce-13.11.0-rc43.tar.gz |
Add latest changes from gitlab-org/gitlab@13-11-stable-eev13.11.0-rc43
Diffstat (limited to 'app/models/commit.rb')
-rw-r--r-- | app/models/commit.rb | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/app/models/commit.rb b/app/models/commit.rb index bf168aaacc5..5c3e3685c64 100644 --- a/app/models/commit.rb +++ b/app/models/commit.rb @@ -62,7 +62,8 @@ class Commit collection.sort do |a, b| operands = [a, b].tap { |o| o.reverse! if sort == 'desc' } - attr1, attr2 = operands.first.public_send(order_by), operands.second.public_send(order_by) # rubocop:disable PublicSend + attr1 = operands.first.public_send(order_by) # rubocop:disable GitlabSecurity/PublicSend + attr2 = operands.second.public_send(order_by) # rubocop:disable GitlabSecurity/PublicSend # use case insensitive comparison for string values order_by.in?(%w[email name]) ? attr1.casecmp(attr2) : attr1 <=> attr2 @@ -222,6 +223,14 @@ class Commit end end + def author_full_text + return unless author_name && author_email + + strong_memoize(:author_full_text) do + "#{author_name} <#{author_email}>" + end + end + # Returns full commit message if title is truncated (greater than 99 characters) # otherwise returns commit message without first line def description |