Commit b0cec593 authored by Samantha Ming's avatar Samantha Ming Committed by Jacques Erasmus

Show reviewers in MR list

Issue: https://gitlab.com/gitlab-org/gitlab/-/issues/237922
parent ccf9b3bc
......@@ -55,6 +55,9 @@
- if merge_request.assignees.any?
%li.d-flex
= render 'shared/issuable/assignees', project: merge_request.project, issuable: merge_request
- if Feature.enabled?(:merge_request_reviewers, @project) && merge_request.reviewers.any?
%li.gl-display-flex.issuable-reviewers
= render 'shared/issuable/reviewers', project: merge_request.project, issuable: merge_request
= render 'projects/merge_requests/approvals_count', merge_request: merge_request
= render 'shared/issuable_meta_data', issuable: merge_request
......
- max_render = 4
- reviewers_rendering_overflow = issuable.reviewers.size > max_render
- render_count = reviewers_rendering_overflow ? max_render - 1 : max_render
- more_reviewers_count = issuable.reviewers.size - render_count
- issuable.reviewers.take(render_count).each do |reviewer| # rubocop: disable CodeReuse/ActiveRecord
= link_to_member(@project, reviewer, name: false, title: _("Review requested from %{name}") % { name: reviewer.name})
- if more_reviewers_count > 0
%span{ class: 'avatar-counter has-tooltip', data: { container: 'body', placement: 'bottom', 'line-type' => 'old' }, title: _("+%{more_reviewers_count} more reviewers") % { more_reviewers_count: more_reviewers_count} }
= _("+%{more_reviewers_count}") % { more_reviewers_count: more_reviewers_count}
......@@ -997,6 +997,12 @@ msgstr[1] ""
msgid "+%{approvers} more approvers"
msgstr ""
msgid "+%{more_reviewers_count}"
msgstr ""
msgid "+%{more_reviewers_count} more reviewers"
msgstr ""
msgid "+%{tags} more"
msgstr ""
......@@ -22196,6 +22202,9 @@ msgstr ""
msgid "Review App|View latest app"
msgstr ""
msgid "Review requested from %{name}"
msgstr ""
msgid "Review the process for configuring service providers in your identity provider — in this case, GitLab is the \"service provider\" or \"relying party\"."
msgstr ""
......
......@@ -8,6 +8,10 @@ RSpec.describe 'Merge requests > User lists merge requests' do
let(:project) { create(:project, :public, :repository) }
let(:user) { create(:user) }
let(:user2) { create(:user) }
let(:user3) { create(:user) }
let(:user4) { create(:user) }
let(:user5) { create(:user) }
before do
@fix = create(:merge_request,
......@@ -15,6 +19,7 @@ RSpec.describe 'Merge requests > User lists merge requests' do
source_project: project,
source_branch: 'fix',
assignees: [user],
reviewers: [user, user2, user3, user4, user5],
milestone: create(:milestone, project: project, due_date: '2013-12-11'),
created_at: 1.minute.ago,
updated_at: 1.minute.ago)
......@@ -23,6 +28,7 @@ RSpec.describe 'Merge requests > User lists merge requests' do
source_project: project,
source_branch: 'markdown',
assignees: [user],
reviewers: [user, user2, user3, user4],
milestone: create(:milestone, project: project, due_date: '2013-12-12'),
created_at: 2.minutes.ago,
updated_at: 2.minutes.ago)
......@@ -34,6 +40,37 @@ RSpec.describe 'Merge requests > User lists merge requests' do
updated_at: 10.seconds.ago)
end
context 'when merge_request_reviewers is turned on' do
before do
stub_feature_flags(merge_request_reviewers: true)
visit_merge_requests(project, reviewer_id: user.id)
end
it 'has reviewers in MR list' do
expect(page).to have_css('.issuable-reviewers')
end
it 'shows reviewers avatar count badge if more_reviewers_count > 4' do
first_issuable_reviewers = first('.issuable-reviewers')
expect(first_issuable_reviewers).to have_content('2')
expect(first_issuable_reviewers).to have_css('.avatar-counter')
end
it 'does not show reviewers avatar count badge if more_reviewers_count <= 4' do
expect(page.all('.issuable-reviewers')[1]).not_to have_css('.avatar-counter')
end
end
context 'when merge_request_reviewers is turned false' do
it 'has no reviewers in MR list' do
stub_feature_flags(merge_request_reviewers: false)
visit_merge_requests(project, reviewer_id: user.id)
expect(page).not_to have_css('.issuable-reviewers')
end
end
it 'filters on no assignee' do
visit_merge_requests(project, assignee_id: IssuableFinder::Params::FILTER_NONE)
......
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