Commit 9d622460 authored by Jiaan Louw's avatar Jiaan Louw Committed by Phil Hughes

Update the approval settings options text

parent 5f965193
...@@ -954,7 +954,7 @@ POST /projects/:id/merge_requests/:merge_request_iid/approve ...@@ -954,7 +954,7 @@ POST /projects/:id/merge_requests/:merge_request_iid/approve
| `id` | integer or string | yes | The ID or [URL-encoded path of a project](index.md#namespaced-path-encoding) | | `id` | integer or string | yes | The ID or [URL-encoded path of a project](index.md#namespaced-path-encoding) |
| `merge_request_iid` | integer | yes | The IID of the merge request | | `merge_request_iid` | integer | yes | The IID of the merge request |
| `sha` | string | no | The `HEAD` of the merge request | | `sha` | string | no | The `HEAD` of the merge request |
| `approval_password` **(PREMIUM)** | string | no | Current user's password. Required if [**Require user password to approve**](../user/project/merge_requests/approvals/settings.md#require-authentication-for-approvals) is enabled in the project settings. | | `approval_password` **(PREMIUM)** | string | no | Current user's password. Required if [**Require user password to approve**](../user/project/merge_requests/approvals/settings.md#require-user-password-to-approve) is enabled in the project settings. |
The `sha` parameter works in the same way as The `sha` parameter works in the same way as
when [accepting a merge request](merge_requests.md#accept-mr): if it is passed, then it must when [accepting a merge request](merge_requests.md#accept-mr): if it is passed, then it must
......
...@@ -24,12 +24,12 @@ To enable merge request approval rules for an instance: ...@@ -24,12 +24,12 @@ To enable merge request approval rules for an instance:
Merge request approval rules that can be set at an instance level are: Merge request approval rules that can be set at an instance level are:
- **Prevent approval of merge requests by merge request author**. Prevents project - **Prevent approval by author**. Prevents project
maintainers from allowing request authors to merge their own merge requests. maintainers from allowing request authors to merge their own merge requests.
- **Prevent approval of merge requests by merge request committers**. Prevents project - **Prevent approvals by users who add commits**. Prevents project
maintainers from allowing users to approve merge requests if they have submitted maintainers from allowing users to approve merge requests if they have submitted
any commits to the source branch. any commits to the source branch.
- **Prevent users from modifying merge request approvers list**. Prevents users from - **Prevent editing approval rules in projects and merge requests**. Prevents users from
modifying the approvers list in project settings or in individual merge requests. modifying the approvers list in project settings or in individual merge requests.
Also read the [project level merge request approval rules](../project/merge_requests/approvals/index.md), which are affected by instance level rules. Also read the [project level merge request approval rules](../project/merge_requests/approvals/index.md), which are affected by instance level rules.
...@@ -60,8 +60,8 @@ We support a separation of duties policy between users who create and approve me ...@@ -60,8 +60,8 @@ We support a separation of duties policy between users who create and approve me
The approval status column can help you identify violations of this policy. The approval status column can help you identify violations of this policy.
Our criteria for the separation of duties is as follows: Our criteria for the separation of duties is as follows:
- [A merge request author is **not** allowed to approve their merge request](../../project/merge_requests/approvals/settings.md#prevent-authors-from-approving-their-own-work) - [A merge request author is **not** allowed to approve their merge request](../../project/merge_requests/approvals/settings.md#prevent-approval-by-author)
- [A merge request committer is **not** allowed to approve a merge request they have added commits to](../../project/merge_requests/approvals/settings.md#prevent-committers-from-approving-their-own-work) - [A merge request committer is **not** allowed to approve a merge request they have added commits to](../../project/merge_requests/approvals/settings.md#prevent-approvals-by-users-who-add-commits)
- [The minimum number of approvals required to merge a merge request is **at least** two](../../project/merge_requests/approvals/rules.md) - [The minimum number of approvals required to merge a merge request is **at least** two](../../project/merge_requests/approvals/rules.md)
The **Approval status** column shows you at a glance whether a merge request is complying with the above. The **Approval status** column shows you at a glance whether a merge request is complying with the above.
......
...@@ -42,17 +42,12 @@ rules to define what types of users can approve work. Some examples of rules you ...@@ -42,17 +42,12 @@ rules to define what types of users can approve work. Some examples of rules you
- Users with specific permissions can be allowed or denied the ability - Users with specific permissions can be allowed or denied the ability
to [override approval rules on a specific merge request](rules.md#edit-or-override-merge-request-approval-rules). to [override approval rules on a specific merge request](rules.md#edit-or-override-merge-request-approval-rules).
You can also configure additional [settings for merge request approvals](settings.md) You can also configure:
for more control of the level of oversight and security your project needs, including:
- [Prevent users from overriding a merge request approval rule.](settings.md#prevent-overrides-of-default-approvals) - Additional [settings for merge request approvals](settings.md) for more control of the
- [Reset approvals when new code is pushed.](settings.md#reset-approvals-on-push) level of oversight and security your project needs.
- Allow (or disallow) [authors and committers](settings.md) to approve their own merge requests. - Merge request approval rules and settings through the GitLab UI or with the
- [Require password authentication when approving.](settings.md#require-authentication-for-approvals) [Merge request approvals API](../../../../api/merge_request_approvals.md).
- [Require security team approval.](settings.md#security-approvals-in-merge-requests)
You can configure your merge request approval rules and settings through the GitLab
user interface or with the [Merge request approvals API](../../../../api/merge_request_approvals.md).
## Approve a merge request ## Approve a merge request
...@@ -74,10 +69,10 @@ such as merge conflicts, [pending discussions](../../../discussions/index.md#pre ...@@ -74,10 +69,10 @@ such as merge conflicts, [pending discussions](../../../discussions/index.md#pre
or a [failed CI/CD pipeline](../merge_when_pipeline_succeeds.md). or a [failed CI/CD pipeline](../merge_when_pipeline_succeeds.md).
To prevent merge request authors from approving their own merge requests, To prevent merge request authors from approving their own merge requests,
enable [**Prevent author approval**](settings.md#prevent-authors-from-approving-their-own-work) enable [**Prevent author approval**](settings.md#prevent-approval-by-author)
in your project's settings. in your project's settings.
If you enable [approval rule overrides](settings.md#prevent-overrides-of-default-approvals), If you enable [approval rule overrides](settings.md#prevent-editing-approval-rules-in-merge-requests),
merge requests created before a change to default approval rules are not affected. merge requests created before a change to default approval rules are not affected.
The only exceptions are changes to the [target branch](rules.md#approvals-for-protected-branches) The only exceptions are changes to the [target branch](rules.md#approvals-for-protected-branches)
of the rule. of the rule.
......
...@@ -49,7 +49,7 @@ Users of GitLab Premium and higher tiers can create [additional approval rules]( ...@@ -49,7 +49,7 @@ Users of GitLab Premium and higher tiers can create [additional approval rules](
Your configuration for approval rule overrides determines if the new rule is applied Your configuration for approval rule overrides determines if the new rule is applied
to existing merge requests: to existing merge requests:
- If [approval rule overrides](settings.md#prevent-overrides-of-default-approvals) are allowed, - If [approval rule overrides](settings.md#prevent-editing-approval-rules-in-merge-requests) are allowed,
changes to these default rules are not applied to existing merge requests, except for changes to these default rules are not applied to existing merge requests, except for
changes to the [target branch](#approvals-for-protected-branches) of the rule. changes to the [target branch](#approvals-for-protected-branches) of the rule.
- If approval rule overrides are not allowed, all changes to default rules - If approval rule overrides are not allowed, all changes to default rules
...@@ -138,10 +138,10 @@ approve in these ways: ...@@ -138,10 +138,10 @@ approve in these ways:
counts as one approver, and not two. counts as one approver, and not two.
- Merge request authors do not count as eligible approvers on their own merge requests by default. - Merge request authors do not count as eligible approvers on their own merge requests by default.
To change this behavior, disable the To change this behavior, disable the
[**Prevent author approval**](settings.md#prevent-authors-from-approving-their-own-work) [**Prevent author approval**](settings.md#prevent-approval-by-author)
project setting. project setting.
- Committers to merge requests can approve a merge request. To change this behavior, enable the - Committers to merge requests can approve a merge request. To change this behavior, enable the
[**Prevent committers approval**](settings.md#prevent-committers-from-approving-their-own-work) [**Prevent committers approval**](settings.md#prevent-approvals-by-users-who-add-commits)
project setting. project setting.
### Code owners as eligible approvers **(PREMIUM)** ### Code owners as eligible approvers **(PREMIUM)**
...@@ -201,7 +201,7 @@ on a merge request, you can either add or remove approvers: ...@@ -201,7 +201,7 @@ on a merge request, you can either add or remove approvers:
1. Add or remove your desired approval rules. 1. Add or remove your desired approval rules.
1. Select **Save changes**. 1. Select **Save changes**.
Administrators can change the [merge request approvals settings](settings.md#prevent-overrides-of-default-approvals) Administrators can change the [merge request approvals settings](settings.md#prevent-editing-approval-rules-in-merge-requests)
to prevent users from overriding approval rules for merge requests. to prevent users from overriding approval rules for merge requests.
## Configure optional approval rules **(PREMIUM)** ## Configure optional approval rules **(PREMIUM)**
......
...@@ -20,37 +20,17 @@ To view or edit merge request approval settings: ...@@ -20,37 +20,17 @@ To view or edit merge request approval settings:
1. Go to your project and select **Settings > General**. 1. Go to your project and select **Settings > General**.
1. Expand **Merge request (MR) approvals**. 1. Expand **Merge request (MR) approvals**.
In this section of general settings, you can configure the settings described In this section of general settings, you can configure the following settings:
on this page.
## Prevent overrides of default approvals | Setting | Description |
| ------ | ------ |
| [Prevent approval by author](#prevent-approval-by-author) | When enabled, the author of a merge request cannot approve it. |
| [Prevent approvals by users who add commits](#prevent-approvals-by-users-who-add-commits) | When enabled, users who have committed to a merge request cannot approve it. |
| [Prevent editing approval rules in merge requests](#prevent-editing-approval-rules-in-merge-requests) | When enabled, users can't override the project's approval rules on merge requests. |
| [Require user password to approve](#require-user-password-to-approve) | Force potential approvers to first authenticate with a password. |
| [Remove all approvals when commits are added to the source branch](#remove-all-approvals-when-commits-are-added-to-the-source-branch) | When enabled, remove all existing approvals on a merge request when more changes are added to it. |
By default, users can override the approval rules you [create for a project](rules.md) ## Prevent approval by author **(PREMIUM)**
on a per-merge request basis. If you don't want users to change approval rules
on merge requests, you can disable this setting:
1. Go to your project and select **Settings > General**.
1. Expand **Merge request (MR) approvals**.
1. Select the **Prevent users from modifying MR approval rules in merge requests** checkbox.
1. Select **Save changes**.
This change affects all open merge requests.
## Reset approvals on push
By default, an approval on a merge request remains in place, even if you add more changes
after the approval. If you want to remove all existing approvals on a merge request
when more changes are added to it:
1. Go to your project and select **Settings > General**.
1. Expand **Merge request (MR) approvals**.
1. Select the **Require new approvals when new commits are added to an MR** checkbox.
1. Select **Save changes**.
Approvals aren't reset when a merge request is [rebased from the UI](../fast_forward_merge.md)
However, approvals are reset if the target branch is changed.
## Prevent authors from approving their own work **(PREMIUM)**
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/3349) in GitLab 11.3. > - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/3349) in GitLab 11.3.
> - Moved to GitLab Premium in 13.9. > - Moved to GitLab Premium in 13.9.
...@@ -65,14 +45,14 @@ By default, the author of a merge request cannot approve it. To change this sett ...@@ -65,14 +45,14 @@ By default, the author of a merge request cannot approve it. To change this sett
Authors can edit the approval rule in an individual merge request and override Authors can edit the approval rule in an individual merge request and override
this setting, unless you configure one of these options: this setting, unless you configure one of these options:
- [Prevent overrides of default approvals](#prevent-overrides-of-default-approvals) at - [Prevent overrides of default approvals](#prevent-editing-approval-rules-in-merge-requests) at
the project level. the project level.
- *(Self-managed instances only)* Prevent overrides of default approvals - *(Self-managed instances only)* Prevent overrides of default approvals
[at the instance level](../../../admin_area/merge_requests_approvals.md). When configured [at the instance level](../../../admin_area/merge_requests_approvals.md). When configured
at the instance level, you can't edit this setting at the project or individual at the instance level, you can't edit this setting at the project or individual
merge request levels. merge request levels.
## Prevent committers from approving their own work **(PREMIUM)** ## Prevent approvals by users who add commits **(PREMIUM)**
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/10441) in GitLab 11.10. > - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/10441) in GitLab 11.10.
> - Moved to GitLab Premium in 13.9. > - Moved to GitLab Premium in 13.9.
...@@ -96,7 +76,20 @@ to a merge request can approve merge requests that affect files they own. ...@@ -96,7 +76,20 @@ to a merge request can approve merge requests that affect files they own.
To learn more about the [differences between authors and committers](https://git-scm.com/book/en/v2/Git-Basics-Viewing-the-Commit-History), To learn more about the [differences between authors and committers](https://git-scm.com/book/en/v2/Git-Basics-Viewing-the-Commit-History),
read the official Git documentation for an explanation. read the official Git documentation for an explanation.
## Require authentication for approvals ## Prevent editing approval rules in merge requests
By default, users can override the approval rules you [create for a project](rules.md)
on a per-merge request basis. If you don't want users to change approval rules
on merge requests, you can disable this setting:
1. Go to your project and select **Settings > General**.
1. Expand **Merge request (MR) approvals**.
1. Select the **Prevent users from modifying MR approval rules in merge requests** checkbox.
1. Select **Save changes**.
This change affects all open merge requests.
## Require user password to approve
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/5981) in GitLab 12.0. > - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/5981) in GitLab 12.0.
> - Moved to GitLab Premium in 13.9. > - Moved to GitLab Premium in 13.9.
...@@ -112,6 +105,20 @@ permission enables an electronic signature for approvals, such as the one define ...@@ -112,6 +105,20 @@ permission enables an electronic signature for approvals, such as the one define
1. Select the **Require user password for approvals** checkbox. 1. Select the **Require user password for approvals** checkbox.
1. Select **Save changes**. 1. Select **Save changes**.
## Remove all approvals when commits are added to the source branch
By default, an approval on a merge request remains in place, even if you add more changes
after the approval. If you want to remove all existing approvals on a merge request
when more changes are added to it:
1. Go to your project and select **Settings > General**.
1. Expand **Merge request (MR) approvals**.
1. Select the **Require new approvals when new commits are added to an MR** checkbox.
1. Select **Save changes**.
Approvals aren't reset when a merge request is [rebased from the UI](../fast_forward_merge.md)
However, approvals are reset if the target branch is changed.
## Security approvals in merge requests **(ULTIMATE)** ## Security approvals in merge requests **(ULTIMATE)**
You can require that a member of your security team approves a merge request if a You can require that a member of your security team approves a merge request if a
......
...@@ -20,6 +20,10 @@ export default { ...@@ -20,6 +20,10 @@ export default {
type: String, type: String,
required: true, required: true,
}, },
settingsLabels: {
type: Object,
required: true,
},
canPreventMrApprovalRuleEdit: { canPreventMrApprovalRuleEdit: {
type: Boolean, type: Boolean,
required: false, required: false,
...@@ -77,11 +81,12 @@ export default { ...@@ -77,11 +81,12 @@ export default {
}, },
}, },
links: { links: {
preventAuthorApprovalDocsAnchor: 'prevent-authors-from-approving-their-own-work', preventAuthorApprovalDocsAnchor: 'prevent-approval-by-author',
preventMrApprovalRuleEditDocsAnchor: 'prevent-overrides-of-default-approvals', preventCommittersApprovalDocsAnchor: 'prevent-approvals-by-users-who-add-commits',
requireUserPasswordDocsAnchor: 'require-authentication-for-approvals', preventMrApprovalRuleEditDocsAnchor: 'prevent-editing-approval-rules-in-merge-requests',
removeApprovalsOnPushDocsAnchor: 'reset-approvals-on-push', requireUserPasswordDocsAnchor: 'require-user-password-to-approve',
preventCommittersApprovalDocsAnchor: 'prevent-committers-from-approving-their-own-work', removeApprovalsOnPushDocsAnchor:
'remove-all-approvals-when-commits-are-added-to-the-source-branch',
}, },
i18n: APPROVAL_SETTINGS_I18N, i18n: APPROVAL_SETTINGS_I18N,
}; };
...@@ -116,7 +121,7 @@ export default { ...@@ -116,7 +121,7 @@ export default {
<gl-form-group> <gl-form-group>
<approval-settings-checkbox <approval-settings-checkbox
v-model="preventAuthorApproval" v-model="preventAuthorApproval"
:label="$options.i18n.authorApprovalLabel" :label="settingsLabels.authorApprovalLabel"
:anchor="$options.links.preventAuthorApprovalDocsAnchor" :anchor="$options.links.preventAuthorApprovalDocsAnchor"
:locked="!canPreventAuthorApproval" :locked="!canPreventAuthorApproval"
:locked-text="$options.i18n.lockedByAdmin" :locked-text="$options.i18n.lockedByAdmin"
...@@ -124,7 +129,7 @@ export default { ...@@ -124,7 +129,7 @@ export default {
/> />
<approval-settings-checkbox <approval-settings-checkbox
v-model="preventCommittersApproval" v-model="preventCommittersApproval"
:label="$options.i18n.preventCommittersApprovalLabel" :label="settingsLabels.preventCommittersApprovalLabel"
:anchor="$options.links.preventCommittersApprovalDocsAnchor" :anchor="$options.links.preventCommittersApprovalDocsAnchor"
:locked="!canPreventCommittersApproval" :locked="!canPreventCommittersApproval"
:locked-text="$options.i18n.lockedByAdmin" :locked-text="$options.i18n.lockedByAdmin"
...@@ -132,7 +137,7 @@ export default { ...@@ -132,7 +137,7 @@ export default {
/> />
<approval-settings-checkbox <approval-settings-checkbox
v-model="preventMrApprovalRuleEdit" v-model="preventMrApprovalRuleEdit"
:label="$options.i18n.preventMrApprovalRuleEditLabel" :label="settingsLabels.preventMrApprovalRuleEditLabel"
:anchor="$options.links.preventMrApprovalRuleEditDocsAnchor" :anchor="$options.links.preventMrApprovalRuleEditDocsAnchor"
:locked="!canPreventMrApprovalRuleEdit" :locked="!canPreventMrApprovalRuleEdit"
:locked-text="$options.i18n.lockedByAdmin" :locked-text="$options.i18n.lockedByAdmin"
...@@ -140,13 +145,13 @@ export default { ...@@ -140,13 +145,13 @@ export default {
/> />
<approval-settings-checkbox <approval-settings-checkbox
v-model="requireUserPassword" v-model="requireUserPassword"
:label="$options.i18n.requireUserPasswordLabel" :label="settingsLabels.requireUserPasswordLabel"
:anchor="$options.links.requireUserPasswordDocsAnchor" :anchor="$options.links.requireUserPasswordDocsAnchor"
data-testid="require-user-password" data-testid="require-user-password"
/> />
<approval-settings-checkbox <approval-settings-checkbox
v-model="removeApprovalsOnPush" v-model="removeApprovalsOnPush"
:label="$options.i18n.removeApprovalsOnPushLabel" :label="settingsLabels.removeApprovalsOnPushLabel"
:anchor="$options.links.removeApprovalsOnPushDocsAnchor" :anchor="$options.links.removeApprovalsOnPushDocsAnchor"
data-testid="remove-approvals-on-push" data-testid="remove-approvals-on-push"
/> />
......
...@@ -3,6 +3,7 @@ import { GlSprintf, GlLink } from '@gitlab/ui'; ...@@ -3,6 +3,7 @@ import { GlSprintf, GlLink } from '@gitlab/ui';
import { helpPagePath } from '~/helpers/help_page_helper'; import { helpPagePath } from '~/helpers/help_page_helper';
import { __ } from '~/locale'; import { __ } 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 ApprovalSettings from '../approval_settings.vue'; import ApprovalSettings from '../approval_settings.vue';
export default { export default {
...@@ -30,6 +31,7 @@ export default { ...@@ -30,6 +31,7 @@ export default {
groupSettingsHeader: __('Merge request approvals'), groupSettingsHeader: __('Merge request approvals'),
groupSettingsDescription: __('Define approval settings. %{linkStart}Learn more.%{linkEnd}'), groupSettingsDescription: __('Define approval settings. %{linkStart}Learn more.%{linkEnd}'),
}, },
labels: GROUP_APPROVAL_SETTINGS_LABELS_I18N,
}; };
</script> </script>
...@@ -46,7 +48,10 @@ export default { ...@@ -46,7 +48,10 @@ export default {
</gl-sprintf> </gl-sprintf>
</template> </template>
<template #default> <template #default>
<approval-settings :approval-settings-path="approvalSettingsPath" /> <approval-settings
:approval-settings-path="approvalSettingsPath"
:settings-labels="$options.labels"
/>
</template> </template>
</settings-block> </settings-block>
</template> </template>
<script> <script>
import { mapState } from 'vuex'; import { mapState } from 'vuex';
import { __ } from '~/locale'; import { __ } from '~/locale';
import { PROJECT_APPROVAL_SETTINGS_LABELS_I18N } from '../../constants';
import ApprovalSettings from '../approval_settings.vue'; import ApprovalSettings from '../approval_settings.vue';
export default { export default {
...@@ -18,6 +19,7 @@ export default { ...@@ -18,6 +19,7 @@ export default {
i18n: { i18n: {
projectSettingsHeader: __('Approval settings'), projectSettingsHeader: __('Approval settings'),
}, },
labels: PROJECT_APPROVAL_SETTINGS_LABELS_I18N,
}; };
</script> </script>
...@@ -31,6 +33,7 @@ export default { ...@@ -31,6 +33,7 @@ export default {
:can-prevent-author-approval="canModifyAuthorSettings" :can-prevent-author-approval="canModifyAuthorSettings"
:can-prevent-committers-approval="canModifyCommiterSettings" :can-prevent-committers-approval="canModifyCommiterSettings"
:can-prevent-mr-approval-rule-edit="canPreventMrApprovalRuleEdit" :can-prevent-mr-approval-rule-edit="canPreventMrApprovalRuleEdit"
:settings-labels="$options.labels"
/> />
</div> </div>
</template> </template>
...@@ -50,17 +50,6 @@ export const APPROVAL_RULE_CONFIGS = { ...@@ -50,17 +50,6 @@ export const APPROVAL_RULE_CONFIGS = {
export const APPROVALS_HELP_PATH = 'user/project/merge_requests/approvals/settings'; export const APPROVALS_HELP_PATH = 'user/project/merge_requests/approvals/settings';
export const APPROVAL_SETTINGS_I18N = { export const APPROVAL_SETTINGS_I18N = {
authorApprovalLabel: s__('ApprovalSettings|Prevent MR approvals by the author.'),
preventMrApprovalRuleEditLabel: s__(
'ApprovalSettings|Prevent users from modifying MR approval rules.',
),
preventCommittersApprovalLabel: s__(
'ApprovalSettings|Prevent approval of merge requests by merge request committers.',
),
requireUserPasswordLabel: s__('ApprovalSettings|Require user password for approvals.'),
removeApprovalsOnPushLabel: s__(
'ApprovalSettings|Remove all approvals in a merge request when new commits are pushed to its source branch.',
),
saveChanges: __('Save changes'), saveChanges: __('Save changes'),
loadingErrorMessage: s__( loadingErrorMessage: s__(
'ApprovalSettings|There was an error loading merge request approval settings.', 'ApprovalSettings|There was an error loading merge request approval settings.',
...@@ -74,6 +63,27 @@ export const APPROVAL_SETTINGS_I18N = { ...@@ -74,6 +63,27 @@ export const APPROVAL_SETTINGS_I18N = {
), ),
}; };
export const PROJECT_APPROVAL_SETTINGS_LABELS_I18N = {
authorApprovalLabel: s__('ApprovalSettings|Prevent approval by author.'),
preventMrApprovalRuleEditLabel: s__(
'ApprovalSettings|Prevent editing approval rules in merge requests.',
),
preventCommittersApprovalLabel: s__(
'ApprovalSettings|Prevent approvals by users who add commits.',
),
requireUserPasswordLabel: s__('ApprovalSettings|Require user password to approve.'),
removeApprovalsOnPushLabel: s__(
'ApprovalSettings|Remove all approvals when commits are added to the source branch.',
),
};
export const GROUP_APPROVAL_SETTINGS_LABELS_I18N = {
...PROJECT_APPROVAL_SETTINGS_LABELS_I18N,
preventMrApprovalRuleEditLabel: s__(
'ApprovalSettings|Prevent editing approval rules in projects and merge requests. ',
),
};
export const APPROVAL_DIALOG_I18N = { export const APPROVAL_DIALOG_I18N = {
form: { form: {
approvalsRequiredLabel: s__('ApprovalRule|Approvals required'), approvalsRequiredLabel: s__('ApprovalRule|Approvals required'),
......
...@@ -5,12 +5,12 @@ ...@@ -5,12 +5,12 @@
.gl-form-checkbox.custom-control.custom-checkbox .gl-form-checkbox.custom-control.custom-checkbox
= f.check_box :prevent_merge_requests_author_approval, class: 'custom-control-input' = f.check_box :prevent_merge_requests_author_approval, class: 'custom-control-input'
= f.label :prevent_merge_requests_author_approval, class: 'custom-control-label' do = f.label :prevent_merge_requests_author_approval, class: 'custom-control-label' do
= _('Prevent MR approvals by author.') = s_('ApprovalSettings|Prevent approval by author.')
.gl-form-checkbox.custom-control.custom-checkbox .gl-form-checkbox.custom-control.custom-checkbox
= f.check_box :prevent_merge_requests_committers_approval, class: 'custom-control-input' = f.check_box :prevent_merge_requests_committers_approval, class: 'custom-control-input'
= f.label :prevent_merge_requests_committers_approval, class: 'custom-control-label' do = f.label :prevent_merge_requests_committers_approval, class: 'custom-control-label' do
= _('Prevent MR approvals from users who make commits to the MR.') = s_('ApprovalSettings|Prevent approvals by users who add commits.')
.gl-form-checkbox.custom-control.custom-checkbox .gl-form-checkbox.custom-control.custom-checkbox
= f.check_box :disable_overriding_approvers_per_merge_request , class: 'custom-control-input' = f.check_box :disable_overriding_approvers_per_merge_request , class: 'custom-control-input'
= f.label :disable_overriding_approvers_per_merge_request , class: 'custom-control-label' do = f.label :disable_overriding_approvers_per_merge_request , class: 'custom-control-label' do
= _('Prevent users from modifying MR approval rules in projects and merge requests.') = s_('ApprovalSettings|Prevent editing approval rules in projects and merge requests.')
...@@ -20,17 +20,17 @@ RSpec.describe 'Admin interacts with merge requests approvals settings' do ...@@ -20,17 +20,17 @@ RSpec.describe 'Admin interacts with merge requests approvals settings' do
it 'updates instance-level merge request approval settings and enforces project-level ones', :js do it 'updates instance-level merge request approval settings and enforces project-level ones', :js do
page.within('.merge-request-approval-settings') do page.within('.merge-request-approval-settings') do
check 'Prevent MR approvals by author.' check 'Prevent approval by author.'
check 'Prevent MR approvals from users who make commits to the MR.' check 'Prevent approvals by users who add commits.'
check _('Prevent users from modifying MR approval rules in projects and merge requests.') check _('Prevent editing approval rules in projects and merge requests.')
click_button('Save changes') click_button('Save changes')
end end
visit(admin_push_rule_path) visit(admin_push_rule_path)
expect(find_field('Prevent MR approvals by author.')).to be_checked expect(find_field('Prevent approval by author.')).to be_checked
expect(find_field('Prevent MR approvals from users who make commits to the MR.')).to be_checked expect(find_field('Prevent approvals by users who add commits.')).to be_checked
expect(find_field(_('Prevent users from modifying MR approval rules in projects and merge requests.'))).to be_checked expect(find_field(_('Prevent editing approval rules in projects and merge requests.'))).to be_checked
visit edit_project_path(project) visit edit_project_path(project)
......
...@@ -3,7 +3,10 @@ import { createLocalVue, shallowMount } from '@vue/test-utils'; ...@@ -3,7 +3,10 @@ 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 {
PROJECT_APPROVAL_SETTINGS_LABELS_I18N,
APPROVAL_SETTINGS_I18N,
} from 'ee/approvals/constants';
import { groupApprovalsMappers } from 'ee/approvals/mappers'; import { groupApprovalsMappers } from 'ee/approvals/mappers';
import createStore from 'ee/approvals/stores'; import createStore from 'ee/approvals/stores';
import approvalSettingsModule from 'ee/approvals/stores/modules/approval_settings/'; import approvalSettingsModule from 'ee/approvals/stores/modules/approval_settings/';
...@@ -43,6 +46,7 @@ describe('ApprovalSettings', () => { ...@@ -43,6 +46,7 @@ describe('ApprovalSettings', () => {
store, store,
propsData: { propsData: {
approvalSettingsPath, approvalSettingsPath,
settingsLabels: PROJECT_APPROVAL_SETTINGS_LABELS_I18N,
...props, ...props,
}, },
stubs: { GlButton }, stubs: { GlButton },
...@@ -151,11 +155,11 @@ describe('ApprovalSettings', () => { ...@@ -151,11 +155,11 @@ describe('ApprovalSettings', () => {
describe.each` describe.each`
testid | action | setting | labelKey | anchor testid | action | setting | labelKey | anchor
${'prevent-author-approval'} | ${'setPreventAuthorApproval'} | ${'preventAuthorApproval'} | ${'authorApprovalLabel'} | ${'prevent-authors-from-approving-their-own-work'} ${'prevent-author-approval'} | ${'setPreventAuthorApproval'} | ${'preventAuthorApproval'} | ${'authorApprovalLabel'} | ${'prevent-approval-by-author'}
${'prevent-committers-approval'} | ${'setPreventCommittersApproval'} | ${'preventCommittersApproval'} | ${'preventCommittersApprovalLabel'} | ${'prevent-committers-from-approving-their-own-work'} ${'prevent-committers-approval'} | ${'setPreventCommittersApproval'} | ${'preventCommittersApproval'} | ${'preventCommittersApprovalLabel'} | ${'prevent-approvals-by-users-who-add-commits'}
${'prevent-mr-approval-rule-edit'} | ${'setPreventMrApprovalRuleEdit'} | ${'preventMrApprovalRuleEdit'} | ${'preventMrApprovalRuleEditLabel'} | ${'prevent-overrides-of-default-approvals'} ${'prevent-mr-approval-rule-edit'} | ${'setPreventMrApprovalRuleEdit'} | ${'preventMrApprovalRuleEdit'} | ${'preventMrApprovalRuleEditLabel'} | ${'prevent-editing-approval-rules-in-merge-requests'}
${'require-user-password'} | ${'setRequireUserPassword'} | ${'requireUserPassword'} | ${'requireUserPasswordLabel'} | ${'require-authentication-for-approvals'} ${'require-user-password'} | ${'setRequireUserPassword'} | ${'requireUserPassword'} | ${'requireUserPasswordLabel'} | ${'require-user-password-to-approve'}
${'remove-approvals-on-push'} | ${'setRemoveApprovalsOnPush'} | ${'removeApprovalsOnPush'} | ${'removeApprovalsOnPushLabel'} | ${'reset-approvals-on-push'} ${'remove-approvals-on-push'} | ${'setRemoveApprovalsOnPush'} | ${'removeApprovalsOnPush'} | ${'removeApprovalsOnPushLabel'} | ${'remove-all-approvals-when-commits-are-added-to-the-source-branch'}
`('with the $testid checkbox', ({ testid, action, setting, labelKey, anchor }) => { `('with the $testid checkbox', ({ testid, action, setting, labelKey, anchor }) => {
let checkbox = null; let checkbox = null;
...@@ -177,7 +181,7 @@ describe('ApprovalSettings', () => { ...@@ -177,7 +181,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: APPROVAL_SETTINGS_I18N[labelKey], label: PROJECT_APPROVAL_SETTINGS_LABELS_I18N[labelKey],
}); });
}); });
......
...@@ -6,6 +6,7 @@ import Vuex from 'vuex'; ...@@ -6,6 +6,7 @@ import Vuex from 'vuex';
import ApprovalSettings from 'ee/approvals/components/approval_settings.vue'; import ApprovalSettings from 'ee/approvals/components/approval_settings.vue';
import GroupSettingsApp from 'ee/approvals/components/group_settings/app.vue'; import GroupSettingsApp from 'ee/approvals/components/group_settings/app.vue';
import { GROUP_APPROVAL_SETTINGS_LABELS_I18N } from 'ee/approvals/constants';
import { groupApprovalsMappers } from 'ee/approvals/mappers'; import { groupApprovalsMappers } 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';
...@@ -76,6 +77,9 @@ describe('EE Approvals Group Settings App', () => { ...@@ -76,6 +77,9 @@ describe('EE Approvals Group Settings App', () => {
createWrapper(); createWrapper();
expect(findApprovalSettings().exists()).toBe(true); expect(findApprovalSettings().exists()).toBe(true);
expect(findApprovalSettings().props('approvalSettingsPath')).toBe(approvalSettingsPath); expect(findApprovalSettings().props()).toMatchObject({
approvalSettingsPath,
settingsLabels: GROUP_APPROVAL_SETTINGS_LABELS_I18N,
});
}); });
}); });
...@@ -3,6 +3,7 @@ import Vue from 'vue'; ...@@ -3,6 +3,7 @@ import Vue from 'vue';
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 ProjectApprovalSettings from 'ee/approvals/components/project_settings/project_approval_settings.vue'; import ProjectApprovalSettings from 'ee/approvals/components/project_settings/project_approval_settings.vue';
import { PROJECT_APPROVAL_SETTINGS_LABELS_I18N } from 'ee/approvals/constants';
import { projectApprovalsMappers } from 'ee/approvals/mappers'; import { projectApprovalsMappers } from 'ee/approvals/mappers';
import createStore from 'ee/approvals/stores'; import createStore from 'ee/approvals/stores';
import approvalSettingsModule from 'ee/approvals/stores/modules/approval_settings'; import approvalSettingsModule from 'ee/approvals/stores/modules/approval_settings';
...@@ -46,6 +47,7 @@ describe('ProjectApprovalSettings', () => { ...@@ -46,6 +47,7 @@ describe('ProjectApprovalSettings', () => {
canPreventMrApprovalRuleEdit: true, canPreventMrApprovalRuleEdit: true,
canPreventAuthorApproval: false, canPreventAuthorApproval: false,
canPreventCommittersApproval: true, canPreventCommittersApproval: true,
settingsLabels: PROJECT_APPROVAL_SETTINGS_LABELS_I18N,
}); });
}); });
}); });
...@@ -4244,19 +4244,25 @@ msgstr "" ...@@ -4244,19 +4244,25 @@ msgstr ""
msgid "ApprovalSettings|Merge request approval settings have been updated." msgid "ApprovalSettings|Merge request approval settings have been updated."
msgstr "" msgstr ""
msgid "ApprovalSettings|Prevent MR approvals by the author." msgid "ApprovalSettings|Prevent approval by author."
msgstr "" msgstr ""
msgid "ApprovalSettings|Prevent approval of merge requests by merge request committers." msgid "ApprovalSettings|Prevent approvals by users who add commits."
msgstr "" msgstr ""
msgid "ApprovalSettings|Prevent users from modifying MR approval rules." msgid "ApprovalSettings|Prevent editing approval rules in merge requests."
msgstr "" msgstr ""
msgid "ApprovalSettings|Remove all approvals in a merge request when new commits are pushed to its source branch." msgid "ApprovalSettings|Prevent editing approval rules in projects and merge requests."
msgstr "" msgstr ""
msgid "ApprovalSettings|Require user password for approvals." msgid "ApprovalSettings|Prevent editing approval rules in projects and merge requests. "
msgstr ""
msgid "ApprovalSettings|Remove all approvals when commits are added to the source branch."
msgstr ""
msgid "ApprovalSettings|Require user password to approve."
msgstr "" msgstr ""
msgid "ApprovalSettings|There was an error loading merge request approval settings." msgid "ApprovalSettings|There was an error loading merge request approval settings."
...@@ -25236,13 +25242,10 @@ msgstr "" ...@@ -25236,13 +25242,10 @@ msgstr ""
msgid "Prev" msgid "Prev"
msgstr "" msgstr ""
msgid "Prevent MR approvals by author." msgid "Prevent adding new members to project membership within this group"
msgstr ""
msgid "Prevent MR approvals from users who make commits to the MR."
msgstr "" msgstr ""
msgid "Prevent adding new members to project membership within this group" msgid "Prevent editing approval rules in projects and merge requests."
msgstr "" msgstr ""
msgid "Prevent environment from auto-stopping" msgid "Prevent environment from auto-stopping"
...@@ -25254,9 +25257,6 @@ msgstr "" ...@@ -25254,9 +25257,6 @@ msgstr ""
msgid "Prevent users from changing their profile name" msgid "Prevent users from changing their profile name"
msgstr "" msgstr ""
msgid "Prevent users from modifying MR approval rules in projects and merge requests."
msgstr ""
msgid "Prevent users from performing write operations on GitLab while performing maintenance." msgid "Prevent users from performing write operations on GitLab while performing maintenance."
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