Commit ee217fc0 authored by Paul Slaughter's avatar Paul Slaughter

Move optional approval text to messages

**Why?**
These messages will be needed by the multiple approval rules component.
parent 696f85b3
......@@ -7,3 +7,5 @@ export const FETCH_ERROR = s__(
export const APPROVE_ERROR = s__('mrWidget|An error occurred while submitting your approval.');
export const UNAPPROVE_ERROR = s__('mrWidget|An error occurred while removing your approval.');
export const APPROVED_MESSAGE = s__('mrWidget|Merge request approved.');
export const OPTIONAL_CAN_APPROVE = s__('mrWidget|No approval required; you can still approve');
export const OPTIONAL = s__('mrWidget|No approval required');
......@@ -5,7 +5,7 @@ import Icon from '~/vue_shared/components/icon.vue';
import MrWidgetAuthor from '~/vue_merge_request_widget/components/mr_widget_author.vue';
import tooltip from '~/vue_shared/directives/tooltip';
import eventHub from '~/vue_merge_request_widget/event_hub';
import { APPROVE_ERROR } from '../messages';
import { APPROVE_ERROR, OPTIONAL_CAN_APPROVE, OPTIONAL } from '../messages';
export default {
name: 'ApprovalsBody',
......@@ -65,10 +65,10 @@ export default {
approvalsRequiredStringified() {
if (this.approvalsOptional) {
if (this.userCanApprove) {
return s__('mrWidget|No Approval required; you can still approve');
return OPTIONAL_CAN_APPROVE;
}
return s__('mrWidget|No Approval required');
return OPTIONAL;
}
if (this.approvalsLeft === 0) {
......
import Vue from 'vue';
import ApprovalsBody from 'ee/vue_merge_request_widget/components/approvals/single_rule/approvals_body.vue';
import {
OPTIONAL,
OPTIONAL_CAN_APPROVE,
} from 'ee/vue_merge_request_widget/components/approvals/messages';
describe('Approvals Body Component', () => {
let vm;
......@@ -62,7 +66,7 @@ describe('Approvals Body Component', () => {
});
it('should display the correct string for 0 approvals required', done => {
const correctText = 'No Approval required';
const correctText = OPTIONAL;
vm.approvalsOptional = true;
......@@ -73,7 +77,7 @@ describe('Approvals Body Component', () => {
});
it('should display the correct string for 0 approvals required and if the user is able to approve', done => {
const correctText = 'No Approval required; you can still approve';
const correctText = OPTIONAL_CAN_APPROVE;
vm.approvalsOptional = true;
vm.userCanApprove = true;
......
......@@ -11978,10 +11978,10 @@ msgstr ""
msgid "mrWidget|Merged by"
msgstr ""
msgid "mrWidget|No Approval required"
msgid "mrWidget|No approval required"
msgstr ""
msgid "mrWidget|No Approval required; you can still approve"
msgid "mrWidget|No approval required; you can still approve"
msgstr ""
msgid "mrWidget|Open in Web IDE"
......
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