Commit 3f4d1ae9 authored by Jan Provaznik's avatar Jan Provaznik

Merge branch 'ph/329227/mrCommitListCommitter' into 'master'

Added committer user to merge request commit list

See merge request gitlab-org/gitlab!70596
parents 10209b62 f0fa21ec
......@@ -17,6 +17,15 @@ module CommitsHelper
commit_person_link(commit, options.merge(source: :committer))
end
def commit_committer_avatar(committer, options = {})
user_avatar(options.merge({
user: committer,
user_name: committer.name,
user_email: committer.email,
css_class: 'd-none d-sm-inline-block float-none gl-mr-0! gl-vertical-align-text-bottom'
}))
end
def commit_to_html(commit, ref, project)
render 'projects/commits/commit.html',
commit: commit,
......
......@@ -39,8 +39,14 @@
.committer
- commit_author_link = commit_author_link(commit, avatar: false, size: 24)
- commit_timeago = time_ago_with_tooltip(commit.authored_date, placement: 'bottom')
- commit_text = _('%{commit_author_link} authored %{commit_timeago}') % { commit_author_link: commit_author_link, commit_timeago: commit_timeago }
- commit_authored_timeago = time_ago_with_tooltip(commit.authored_date, placement: 'bottom')
- if commit.different_committer? && commit.committer
- commit_committer_link = commit_committer_link(commit)
- commit_committer_timeago = time_ago_with_tooltip(commit.committed_date, placement: 'bottom')
- commit_committer_avatar = commit_committer_avatar(commit.committer, size: 18, has_tooltip: false)
- commit_text = _('%{commit_author_link} authored %{commit_authored_timeago} and %{commit_committer_avatar} %{commit_committer_link} committed %{commit_committer_timeago}') % { commit_author_link: commit_author_link, commit_authored_timeago: commit_authored_timeago, commit_committer_avatar: commit_committer_avatar, commit_committer_link: commit_committer_link, commit_committer_timeago: commit_committer_timeago }
- else
- commit_text = _('%{commit_author_link} authored %{commit_authored_timeago}') % { commit_author_link: commit_author_link, commit_authored_timeago: commit_authored_timeago }
#{ commit_text.html_safe }
= render_if_exists 'projects/commits/project_namespace', show_project_name: show_project_name, project: project
......
......@@ -465,7 +465,10 @@ msgstr ""
msgid "%{code_open}Protected:%{code_close} Only exposed to protected branches or tags."
msgstr ""
msgid "%{commit_author_link} authored %{commit_timeago}"
msgid "%{commit_author_link} authored %{commit_authored_timeago}"
msgstr ""
msgid "%{commit_author_link} authored %{commit_authored_timeago} and %{commit_committer_avatar} %{commit_committer_link} committed %{commit_committer_timeago}"
msgstr ""
msgid "%{completedCount} completed weight"
......
......@@ -11,6 +11,24 @@ RSpec.describe 'projects/commits/_commit.html.haml' do
allow(view).to receive(:current_application_settings).and_return(Gitlab::CurrentSettings.current_application_settings)
end
context 'with different committer' do
let(:ref) { 'master' }
let(:committer) { create(:user) }
it 'renders committed by user' do
allow(commit).to receive(:different_committer?).and_return(true)
allow(commit).to receive(:committer).and_return(committer)
render partial: template, locals: {
project: project,
ref: ref,
commit: commit
}
expect(rendered).to have_text("#{committer.name} committed")
end
end
context 'with a signed commit' do
let(:ref) { GpgHelpers::SIGNED_COMMIT_SHA }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment