Skip to content
Snippets Groups Projects
Unverified Commit c5f7efb8 authored by Kushal Pandya's avatar Kushal Pandya Committed by GitLab
Browse files

Merge branch 'ph/499064/approvalSummaryApprovedText' into 'master'

Updated summary text for approvals in reviewers sidebar widget

See merge request https://gitlab.com/gitlab-org/gitlab/-/merge_requests/169146



Merged-by: default avatarKushal Pandya <kushal@gitlab.com>
Approved-by: default avatarMichael Le <mle@gitlab.com>
Approved-by: default avatarKushal Pandya <kushal@gitlab.com>
Co-authored-by: Phil Hughes's avatarPhil Hughes <me@iamphill.com>
parents 44c27303 2f040f75
No related branches found
No related tags found
No related merge requests found
<script>
import { n__, sprintf, s__ } from '~/locale';
import { n__, sprintf, s__, __ } from '~/locale';
import { getApprovalRuleNamesLeft } from 'ee/vue_merge_request_widget/mappers';
import { toNounSeriesText } from '~/lib/utils/grammar';
import { TYPENAME_MERGE_REQUEST } from '~/graphql_shared/constants';
Loading
Loading
@@ -81,6 +81,10 @@ export default {
return s__('mrWidget|Approval is optional');
}
 
if (this.mergeRequest.approved) {
return __('All required approvals given');
}
if (this.rulesLeft.length && !this.shortText) {
return sprintf(
n__(
Loading
Loading
Loading
Loading
@@ -3,6 +3,7 @@ query approvalSummary($projectPath: ID!, $iid: String!) {
id
mergeRequest(iid: $iid) {
id
approved
approvalsLeft
approvalsRequired
approvedBy {
Loading
Loading
Loading
Loading
@@ -2,6 +2,7 @@ subscription approvalSummarySubscription($issuableId: IssuableID!) {
mergeRequestApprovalStateUpdated(issuableId: $issuableId) {
... on MergeRequest {
id
approved
approvalsLeft
approvalsRequired
approvedBy {
Loading
Loading
Loading
Loading
@@ -16,6 +16,7 @@ const mockData = ({ approvalsRequired = 1, approvalsLeft = 1, approvedBy = [] }
id: 1,
mergeRequest: {
id: 1,
approved: approvalsLeft === 0,
approvalsLeft,
approvalsRequired,
approvedBy: {
Loading
Loading
@@ -79,6 +80,16 @@ describe('Reviewers drawer approval summary component', () => {
 
expect(wrapper.text()).toBe('Requires 1 approval from Code Owners.');
});
it('renders approval given when approved', async () => {
createComponent({
resolver: jest.fn().mockResolvedValue(mockData({ approvalsLeft: 0 })),
});
await waitForPromises();
expect(wrapper.text()).toBe('All required approvals given');
});
});
 
describe('when approval is optional', () => {
Loading
Loading
@@ -98,6 +109,8 @@ describe('Reviewers drawer approval summary component', () => {
 
await waitForPromises();
 
expect(wrapper.text()).toBe('Requires 1 approval from Code Owners.');
mockedSubscription.next({
data: {
mergeRequestApprovalStateUpdated: mockData({
Loading
Loading
@@ -110,6 +123,6 @@ describe('Reviewers drawer approval summary component', () => {
 
await waitForPromises();
 
expect(wrapper.text()).toBe('Requires 0 approvals from Code Owners.');
expect(wrapper.text()).toBe('All required approvals given');
});
});
Loading
Loading
@@ -5665,6 +5665,9 @@ msgstr ""
msgid "All protected branches"
msgstr ""
 
msgid "All required approvals given"
msgstr ""
msgid "All required approvals must be given."
msgstr ""
 
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment