Skip to content
代码片段 群组 项目
未验证 提交 c5f7efb8 编辑于 作者: Kushal Pandya's avatar Kushal Pandya 提交者: GitLab
浏览文件

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: default avatarPhil Hughes <me@iamphill.com>
No related branches found
No related tags 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';
......@@ -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__(
......
......@@ -3,6 +3,7 @@ query approvalSummary($projectPath: ID!, $iid: String!) {
id
mergeRequest(iid: $iid) {
id
approved
approvalsLeft
approvalsRequired
approvedBy {
......
......@@ -2,6 +2,7 @@ subscription approvalSummarySubscription($issuableId: IssuableID!) {
mergeRequestApprovalStateUpdated(issuableId: $issuableId) {
... on MergeRequest {
id
approved
approvalsLeft
approvalsRequired
approvedBy {
......
......@@ -16,6 +16,7 @@ const mockData = ({ approvalsRequired = 1, approvalsLeft = 1, approvedBy = [] }
id: 1,
mergeRequest: {
id: 1,
approved: approvalsLeft === 0,
approvalsLeft,
approvalsRequired,
approvedBy: {
......@@ -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', () => {
......@@ -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({
......@@ -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');
});
});
......@@ -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% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册