Commit 664b6528 authored by Simon Knox's avatar Simon Knox

Merge branch '326314-move-approval-settings-i18n-to-constants' into 'master'

Move approvals settings i18n to constants

See merge request gitlab-org/gitlab!61127
parents 243636e9 7de2629c
<script> <script>
import { GlButton, GlForm, GlFormGroup } from '@gitlab/ui'; import { GlButton, GlForm, GlFormGroup } from '@gitlab/ui';
import { mapActions, mapState } from 'vuex'; import { mapActions, mapState } from 'vuex';
import { __ } from '~/locale'; import { APPROVAL_SETTINGS_I18N } from '../constants';
import ApprovalSettingsCheckbox from './approval_settings_checkbox.vue'; import ApprovalSettingsCheckbox from './approval_settings_checkbox.vue';
export default { export default {
...@@ -40,18 +40,7 @@ export default { ...@@ -40,18 +40,7 @@ export default {
removeApprovalsOnPushDocsAnchor: 'resetting-approvals-on-push', removeApprovalsOnPushDocsAnchor: 'resetting-approvals-on-push',
preventCommittersApprovalAnchor: 'prevent-approval-of-merge-requests-by-their-committers', preventCommittersApprovalAnchor: 'prevent-approval-of-merge-requests-by-their-committers',
}, },
i18n: { i18n: APPROVAL_SETTINGS_I18N,
authorApprovalLabel: __('Prevent MR approvals by the author.'),
preventMrApprovalRuleEditLabel: __('Prevent users from modifying MR approval rules.'),
preventCommittersApprovalLabel: __(
'Prevent approval of merge requests by merge request committers.',
),
requireUserPasswordLabel: __('Require user password for approvals.'),
removeApprovalsOnPushLabel: __(
'Remove all approvals in a merge request when new commits are pushed to its source branch.',
),
saveChanges: __('Save changes'),
},
}; };
</script> </script>
......
...@@ -49,3 +49,16 @@ export const APPROVAL_RULE_CONFIGS = { ...@@ -49,3 +49,16 @@ export const APPROVAL_RULE_CONFIGS = {
}; };
export const APPROVALS_HELP_PATH = 'user/project/merge_requests/merge_request_approvals'; export const APPROVALS_HELP_PATH = 'user/project/merge_requests/merge_request_approvals';
export const APPROVAL_SETTINGS_I18N = {
authorApprovalLabel: __('Prevent MR approvals by the author.'),
preventMrApprovalRuleEditLabel: __('Prevent users from modifying MR approval rules.'),
preventCommittersApprovalLabel: __(
'Prevent approval of merge requests by merge request committers.',
),
requireUserPasswordLabel: __('Require user password for approvals.'),
removeApprovalsOnPushLabel: __(
'Remove all approvals in a merge request when new commits are pushed to its source branch.',
),
saveChanges: __('Save changes'),
};
...@@ -3,6 +3,7 @@ import { createLocalVue, shallowMount } from '@vue/test-utils'; ...@@ -3,6 +3,7 @@ import { createLocalVue, shallowMount } from '@vue/test-utils';
import Vuex from 'vuex'; import Vuex from 'vuex';
import ApprovalSettings from 'ee/approvals/components/approval_settings.vue'; import ApprovalSettings from 'ee/approvals/components/approval_settings.vue';
import { APPROVAL_SETTINGS_I18N } from 'ee/approvals/constants';
import { createStoreOptions } from 'ee/approvals/stores'; import { createStoreOptions } from 'ee/approvals/stores';
import groupSettingsModule from 'ee/approvals/stores/modules/group_settings'; import groupSettingsModule from 'ee/approvals/stores/modules/group_settings';
import { extendedWrapper } from 'helpers/vue_test_utils_helper'; import { extendedWrapper } from 'helpers/vue_test_utils_helper';
...@@ -50,13 +51,13 @@ describe('ApprovalSettings', () => { ...@@ -50,13 +51,13 @@ describe('ApprovalSettings', () => {
}); });
describe.each` describe.each`
testid | setting | label | anchor testid | setting | labelKey | anchor
${'prevent-author-approval'} | ${'preventAuthorApproval'} | ${'Prevent MR approvals by the author.'} | ${'allowing-merge-request-authors-to-approve-their-own-merge-requests'} ${'prevent-author-approval'} | ${'preventAuthorApproval'} | ${'authorApprovalLabel'} | ${'allowing-merge-request-authors-to-approve-their-own-merge-requests'}
${'prevent-committers-approval'} | ${'preventCommittersApproval'} | ${'Prevent approval of merge requests by merge request committers.'} | ${'prevent-approval-of-merge-requests-by-their-committers'} ${'prevent-committers-approval'} | ${'preventCommittersApproval'} | ${'preventCommittersApprovalLabel'} | ${'prevent-approval-of-merge-requests-by-their-committers'}
${'prevent-mr-approval-rule-edit'} | ${'preventMrApprovalRuleEdit'} | ${'Prevent users from modifying MR approval rules.'} | ${'editing--overriding-approval-rules-per-merge-request'} ${'prevent-mr-approval-rule-edit'} | ${'preventMrApprovalRuleEdit'} | ${'preventMrApprovalRuleEditLabel'} | ${'editing--overriding-approval-rules-per-merge-request'}
${'require-user-password'} | ${'requireUserPassword'} | ${'Require user password for approvals.'} | ${'require-authentication-when-approving-a-merge-request'} ${'require-user-password'} | ${'requireUserPassword'} | ${'requireUserPasswordLabel'} | ${'require-authentication-when-approving-a-merge-request'}
${'remove-approvals-on-push'} | ${'removeApprovalsOnPush'} | ${'Remove all approvals in a merge request when new commits are pushed to its source branch.'} | ${'resetting-approvals-on-push'} ${'remove-approvals-on-push'} | ${'removeApprovalsOnPush'} | ${'removeApprovalsOnPushLabel'} | ${'resetting-approvals-on-push'}
`('with $testid checkbox', ({ testid, setting, label, anchor }) => { `('with $testid checkbox', ({ testid, setting, labelKey, anchor }) => {
let checkbox = null; let checkbox = null;
beforeEach(() => { beforeEach(() => {
...@@ -76,7 +77,7 @@ describe('ApprovalSettings', () => { ...@@ -76,7 +77,7 @@ describe('ApprovalSettings', () => {
it('has the anchor and label props', () => { it('has the anchor and label props', () => {
expect(checkbox.props()).toMatchObject({ expect(checkbox.props()).toMatchObject({
anchor, anchor,
label, label: APPROVAL_SETTINGS_I18N[labelKey],
}); });
}); });
......
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