Commit 1ca49703 authored by Phil Hughes's avatar Phil Hughes

Merge branch 'approval-icon' into 'master'

Use different approval icon if current user approved

See merge request gitlab-org/gitlab!28290
parents 76b7a0e8 b49632f4
---
title: Use different approval icon if current user approved
merge_request: 28290
author: Steffen Köhler
type: changed
- if merge_request.approval_needed?
%li.d-none.d-sm-inline-block.has-tooltip{ title: _('Approvals'), class: ('text-success' if merge_request.approved?) }
= sprite_icon('approval', size: 16, css_class: 'align-middle')
- approval_tooltip = merge_request.has_approved?(current_user) ? _("Approvals (you've approved)") : _("Approvals")
%li.d-none.d-sm-inline-block.has-tooltip{ title: approval_tooltip, class: ('text-success' if merge_request.approved?) }
= sprite_icon((merge_request.has_approved?(current_user) ? 'approval-solid' : 'approval'), size: 16, css_class: 'align-middle')
= merge_request.approvals_given
%span of
= merge_request.approvals_required
# frozen_string_literal: true
require 'spec_helper'
describe 'User views all merge requests' do
let!(:merge_request) { create(:merge_request, source_project: project, target_project: project) }
let(:project) { create(:project, :public, approvals_before_merge: 1) }
let(:user) { create(:user) }
it 'shows generic approvals tooltip' do
visit(project_merge_requests_path(project, state: :all))
expect(page.all('li').any? { |item| item["title"] == "Approvals"}).to be true
end
it 'shows custom tooltip after user has approved' do
project.add_developer(user)
sign_in(user)
merge_request.approvals.create(user: user)
visit(project_merge_requests_path(project, state: :all))
expect(page.all('li').any? { |item| item["title"] == "Approvals (you've approved)"}).to be true
end
end
......@@ -2263,6 +2263,9 @@ msgstr ""
msgid "Approvals"
msgstr ""
msgid "Approvals (you've approved)"
msgstr ""
msgid "Approve"
msgstr ""
......
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