Commit 88a6e26e authored by Austin Regnery's avatar Austin Regnery

Update merge request approvals desc and links

Changelog: other

Update translation file

Prettied vue file

Fix split sentence

Applied patches for failing tests

Use namespace formatting

Update translation files

Ran yarn prettier

Change to a non-translated string

Update the pot file by running rake

Fix a prettier error

Add test for project settings

Fix mr approvals settings specs

Update translation files
parent 9064ff02
<script> <script>
import { GlSprintf, GlLink } from '@gitlab/ui'; import { GlSprintf, GlLink } from '@gitlab/ui';
import { helpPagePath } from '~/helpers/help_page_helper'; import { helpPagePath } from '~/helpers/help_page_helper';
import { __ } from '~/locale'; import { __, s__ } from '~/locale';
import SettingsBlock from '~/vue_shared/components/settings/settings_block.vue'; import SettingsBlock from '~/vue_shared/components/settings/settings_block.vue';
import { GROUP_APPROVAL_SETTINGS_LABELS_I18N } from '../../constants'; import { GROUP_APPROVAL_SETTINGS_LABELS_I18N } from '../../constants';
import ApprovalSettings from '../approval_settings.vue'; import ApprovalSettings from '../approval_settings.vue';
...@@ -25,11 +26,16 @@ export default { ...@@ -25,11 +26,16 @@ export default {
}, },
}, },
links: { links: {
groupSettingsDocsPath: helpPagePath('user/project/merge_requests/merge_request_approvals'), groupSettingsDocsPath: helpPagePath('user/project/merge_requests/approvals/index.md'),
separationOfDutiesDocsPath: helpPagePath('user/compliance/compliance_report/index', {
anchor: 'approval-status-and-separation-of-duties',
}),
}, },
i18n: { i18n: {
groupSettingsHeader: __('Merge request approvals'), groupSettingsHeader: __('Merge request approvals'),
groupSettingsDescription: __('Define approval rules. %{linkStart}Learn more.%{linkEnd}'), groupSettingsDescription: s__(
'MergeRequestApprovals|Enforce %{separationLinkStart}separation of duties%{separationLinkEnd} for all projects. %{learnLinkStart}Learn more.%{learnLinkEnd}',
),
}, },
labels: GROUP_APPROVAL_SETTINGS_LABELS_I18N, labels: GROUP_APPROVAL_SETTINGS_LABELS_I18N,
}; };
...@@ -40,10 +46,21 @@ export default { ...@@ -40,10 +46,21 @@ export default {
<template #title> {{ $options.i18n.groupSettingsHeader }}</template> <template #title> {{ $options.i18n.groupSettingsHeader }}</template>
<template #description> <template #description>
<gl-sprintf :message="$options.i18n.groupSettingsDescription"> <gl-sprintf :message="$options.i18n.groupSettingsDescription">
<template #link="{ content }"> <template #separationLink="{ content }">
<gl-link :href="$options.links.groupSettingsDocsPath" target="_blank">{{ <gl-link
content data-testid="group-settings-description"
}}</gl-link> :href="$options.links.separationOfDutiesDocsPath"
target="_blank"
>{{ content }}</gl-link
>
</template>
<template #learnLink="{ content }">
<gl-link
data-testid="group-settings-learn-more"
:href="$options.links.groupSettingsDocsPath"
target="_blank"
>{{ content }}</gl-link
>
</template> </template>
</gl-sprintf> </gl-sprintf>
</template> </template>
......
...@@ -6,7 +6,10 @@ ...@@ -6,7 +6,10 @@
%button.btn.gl-button.btn-default.js-settings-toggle{ type: 'button' } %button.btn.gl-button.btn-default.js-settings-toggle{ type: 'button' }
= expanded_by_default? ? _('Collapse') : _('Expand') = expanded_by_default? ? _('Collapse') : _('Expand')
%p %p
= _('Configure approvals by authors and committers on all projects.') - duties_link_url = help_page_path('user/compliance/compliance_report/index', anchor: 'approval-status-and-separation-of-duties')
- link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: duties_link_url }
= s_('MergeRequestApprovals|Enforce %{link_start}separation of duties%{link_end} for all projects.').html_safe % { link_start: link_start, link_end: '</a>'.html_safe }
= link_to _("Learn more."), help_page_path("user/project/merge_requests/approvals/index.md"), target: '_blank', rel: 'noopener noreferrer'
.settings-content .settings-content
= gitlab_ui_form_for @application_setting, url: general_admin_application_settings_path(anchor: 'js-merge-request-approval-settings'), html: { class: 'fieldset-form' } do |f| = gitlab_ui_form_for @application_setting, url: general_admin_application_settings_path(anchor: 'js-merge-request-approval-settings'), html: { class: 'fieldset-form' } do |f|
......
...@@ -6,7 +6,9 @@ ...@@ -6,7 +6,9 @@
%h4.settings-title.js-settings-toggle.js-settings-toggle-trigger-only= _('Merge request approvals') %h4.settings-title.js-settings-toggle.js-settings-toggle-trigger-only= _('Merge request approvals')
%button.gl-button.btn.btn-default.js-settings-toggle{ type: 'button' }= expanded ? _("Collapse") : _("Expand") %button.gl-button.btn.btn-default.js-settings-toggle{ type: 'button' }= expanded ? _("Collapse") : _("Expand")
%p %p
= _("Define approval rules.") - duties_link_url = help_page_path('user/compliance/compliance_report/index', anchor: 'approval-status-and-separation-of-duties')
- link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: duties_link_url }
= s_('MergeRequestApprovals|Define approval rules and settings to ensure %{link_start}separation of duties%{link_end} for new merge requests.').html_safe % { link_start: link_start, link_end: '</a>'.html_safe }
= link_to _("Learn more."), help_page_path("user/project/merge_requests/approvals/index.md"), target: '_blank', rel: 'noopener noreferrer' = link_to _("Learn more."), help_page_path("user/project/merge_requests/approvals/index.md"), target: '_blank', rel: 'noopener noreferrer'
.settings-content .settings-content
......
...@@ -10,6 +10,7 @@ import { GROUP_APPROVAL_SETTINGS_LABELS_I18N } from 'ee/approvals/constants'; ...@@ -10,6 +10,7 @@ import { GROUP_APPROVAL_SETTINGS_LABELS_I18N } from 'ee/approvals/constants';
import { mergeRequestApprovalSettingsMappers } from 'ee/approvals/mappers'; import { mergeRequestApprovalSettingsMappers } from 'ee/approvals/mappers';
import { createStoreOptions } from 'ee/approvals/stores'; import { createStoreOptions } from 'ee/approvals/stores';
import approvalSettingsModule from 'ee/approvals/stores/modules/approval_settings'; import approvalSettingsModule from 'ee/approvals/stores/modules/approval_settings';
import { extendedWrapper } from 'helpers/vue_test_utils_helper';
import SettingsBlock from '~/vue_shared/components/settings/settings_block.vue'; import SettingsBlock from '~/vue_shared/components/settings/settings_block.vue';
const localVue = createLocalVue(); const localVue = createLocalVue();
...@@ -24,20 +25,22 @@ describe('EE Approvals Group Settings App', () => { ...@@ -24,20 +25,22 @@ describe('EE Approvals Group Settings App', () => {
const approvalSettingsPath = 'groups/22/merge_request_approval_settings'; const approvalSettingsPath = 'groups/22/merge_request_approval_settings';
const createWrapper = () => { const createWrapper = () => {
wrapper = shallowMount(GroupSettingsApp, { wrapper = extendedWrapper(
localVue, shallowMount(GroupSettingsApp, {
store: new Vuex.Store(store), localVue,
propsData: { store: new Vuex.Store(store),
defaultExpanded, propsData: {
approvalSettingsPath, defaultExpanded,
}, approvalSettingsPath,
stubs: { },
ApprovalSettings, stubs: {
GlLink, ApprovalSettings,
GlSprintf, GlLink,
SettingsBlock, GlSprintf,
}, SettingsBlock,
}); },
}),
);
}; };
beforeEach(() => { beforeEach(() => {
...@@ -55,7 +58,8 @@ describe('EE Approvals Group Settings App', () => { ...@@ -55,7 +58,8 @@ describe('EE Approvals Group Settings App', () => {
}); });
const findSettingsBlock = () => wrapper.find(SettingsBlock); const findSettingsBlock = () => wrapper.find(SettingsBlock);
const findLink = () => wrapper.find(GlLink); const findDescriptionLink = () => wrapper.findByTestId('group-settings-description');
const findLearnMoreLink = () => wrapper.findByTestId('group-settings-learn-more');
const findApprovalSettings = () => wrapper.find(ApprovalSettings); const findApprovalSettings = () => wrapper.find(ApprovalSettings);
it('renders a settings block', () => { it('renders a settings block', () => {
...@@ -65,14 +69,15 @@ describe('EE Approvals Group Settings App', () => { ...@@ -65,14 +69,15 @@ describe('EE Approvals Group Settings App', () => {
expect(findSettingsBlock().props('defaultExpanded')).toBe(true); expect(findSettingsBlock().props('defaultExpanded')).toBe(true);
}); });
it('has the correct link', () => { it.each`
findComponent | text | href
${findDescriptionLink} | ${'separation of duties'} | ${'/help/user/compliance/compliance_report/index#approval-status-and-separation-of-duties'}
${findLearnMoreLink} | ${'Learn more.'} | ${'/help/user/project/merge_requests/approvals/index.md'}
`('has the correct link for $text', ({ findComponent, text, href }) => {
createWrapper(); createWrapper();
expect(findLink().attributes()).toMatchObject({ expect(findComponent().attributes()).toMatchObject({ href, target: '_blank' });
href: '/help/user/project/merge_requests/merge_request_approvals', expect(findComponent().text()).toBe(text);
target: '_blank',
});
expect(findLink().text()).toBe('Learn more.');
}); });
it('renders an approval settings component', () => { it('renders an approval settings component', () => {
......
...@@ -15,6 +15,6 @@ RSpec.describe 'admin/push_rules/_merge_request_approvals' do ...@@ -15,6 +15,6 @@ RSpec.describe 'admin/push_rules/_merge_request_approvals' do
render render
expect(rendered).to have_content(_('Merge request approvals')) expect(rendered).to have_content(_('Merge request approvals'))
expect(rendered).to have_content(_('Configure approvals by authors and committers on all projects.')) expect(rendered).to have_content('Enforce separation of duties for all projects. Learn more.')
end end
end end
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'projects/_merge_request_approvals_settings' do
let(:project) { build(:project) }
before do
assign(:project, project)
allow(view).to receive(:expanded).and_return(true)
allow(project).to receive(:feature_available?).and_return(true)
render partial: 'projects/merge_request_approvals_settings'
end
it 'renders the settings title' do
expect(rendered).to have_content 'Merge request approvals'
end
it 'renders the settings app element', :aggregate_failures do
expect(rendered).to have_selector '#js-mr-approvals-settings'
end
it 'renders the loading spinner' do
expect(rendered).to have_selector '.gl-spinner'
end
end
...@@ -8644,9 +8644,6 @@ msgstr "" ...@@ -8644,9 +8644,6 @@ msgstr ""
msgid "Configure advanced permissions, Large File Storage, and two-factor authentication settings." msgid "Configure advanced permissions, Large File Storage, and two-factor authentication settings."
msgstr "" msgstr ""
msgid "Configure approvals by authors and committers on all projects."
msgstr ""
msgid "Configure existing installation" msgid "Configure existing installation"
msgstr "" msgstr ""
...@@ -10909,12 +10906,6 @@ msgstr "" ...@@ -10909,12 +10906,6 @@ msgstr ""
msgid "Define a custom pattern with cron syntax" msgid "Define a custom pattern with cron syntax"
msgstr "" msgstr ""
msgid "Define approval rules."
msgstr ""
msgid "Define approval rules. %{linkStart}Learn more.%{linkEnd}"
msgstr ""
msgid "Define custom rules for what constitutes spam, independent of Akismet" msgid "Define custom rules for what constitutes spam, independent of Akismet"
msgstr "" msgstr ""
...@@ -21561,6 +21552,15 @@ msgstr "" ...@@ -21561,6 +21552,15 @@ msgstr ""
msgid "MergeRequestAnalytics|Time to merge" msgid "MergeRequestAnalytics|Time to merge"
msgstr "" msgstr ""
msgid "MergeRequestApprovals|Define approval rules and settings to ensure %{link_start}separation of duties%{link_end} for new merge requests."
msgstr ""
msgid "MergeRequestApprovals|Enforce %{link_start}separation of duties%{link_end} for all projects."
msgstr ""
msgid "MergeRequestApprovals|Enforce %{separationLinkStart}separation of duties%{separationLinkEnd} for all projects. %{learnLinkStart}Learn more.%{learnLinkEnd}"
msgstr ""
msgid "MergeRequestDiffs|Commenting on lines %{selectStart}start%{selectEnd} to %{end}" msgid "MergeRequestDiffs|Commenting on lines %{selectStart}start%{selectEnd} to %{end}"
msgstr "" 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