Commit 83865fed authored by Vitaly Slobodin's avatar Vitaly Slobodin

Merge branch '235114-remove-approvals-feature-flag' into 'master'

Remove approvalSuggestions feature flag [RUN ALL RSPEC] [RUN AS-IF-FOSS]

See merge request gitlab-org/gitlab!54271
parents c4d97e34 70783954
......@@ -36,7 +36,6 @@ class ProjectsController < Projects::ApplicationController
end
before_action only: [:edit] do
push_frontend_feature_flag(:approval_suggestions, @project, default_enabled: true)
push_frontend_feature_flag(:allow_editing_commit_messages, @project)
end
......
---
name: approval_suggestions
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/38992
rollout_issue_url:
milestone: '13.3'
type: development
group: group::composition analysis
default_enabled: true
......@@ -147,7 +147,7 @@ export default {
</template>
</template>
</rules>
<!-- TODO: Remove feature flag in https://gitlab.com/gitlab-org/gitlab/-/issues/235114 -->
<unconfigured-security-rules v-if="glFeatures.approvalSuggestions" />
<unconfigured-security-rules />
</div>
</template>
......@@ -2,7 +2,6 @@
import { groupBy, isNumber } from 'lodash';
import { mapState, mapActions } from 'vuex';
import { sprintf, __ } from '~/locale';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import { TYPE_USER, TYPE_GROUP, TYPE_HIDDEN_GROUPS } from '../constants';
import ApproversList from './approvers_list.vue';
import ApproversSelect from './approvers_select.vue';
......@@ -23,8 +22,6 @@ export default {
ApproversSelect,
BranchesSelect,
},
// TODO: Remove feature flag in https://gitlab.com/gitlab-org/gitlab/-/issues/235114
mixins: [glFeatureFlagsMixin()],
props: {
initRule: {
type: Object,
......@@ -44,7 +41,7 @@ export default {
},
data() {
const defaults = {
name: '',
name: this.defaultRuleName,
approvalsRequired: 1,
minApprovalsRequired: 0,
approvers: [],
......@@ -57,10 +54,6 @@ export default {
serverValidationErrors: [],
...this.getInitialData(),
};
// TODO: Remove feature flag in https://gitlab.com/gitlab-org/gitlab/-/issues/235114
if (this.glFeatures.approvalSuggestions) {
return { ...defaults, name: this.defaultRuleName || defaults.name };
}
return defaults;
},
......@@ -162,13 +155,9 @@ export default {
return !this.settings.lockedApprovalsRuleName;
},
isNameDisabled() {
// TODO: Remove feature flag in https://gitlab.com/gitlab-org/gitlab/-/issues/235114
if (this.glFeatures.approvalSuggestions) {
return (
Boolean(this.isPersisted || this.defaultRuleName) && READONLY_NAMES.includes(this.name)
);
}
return this.isPersisted && READONLY_NAMES.includes(this.name);
return (
Boolean(this.isPersisted || this.defaultRuleName) && READONLY_NAMES.includes(this.name)
);
},
removeHiddenGroups() {
return this.containsHiddenGroups && !this.approversByType[TYPE_HIDDEN_GROUPS];
......
......@@ -100,15 +100,11 @@ describe('Approvals ModalRuleCreate', () => {
});
});
describe('with approvalSuggestions feature flag', () => {
describe('with approval suggestions', () => {
beforeEach(() => {
createModalState.data = { ...TEST_RULE, defaultRuleName: 'Vulnerability-Check' };
factory({
provide: {
glFeatures: { approvalSuggestions: true },
},
});
factory();
modal = findModal();
form = findForm();
});
......
......@@ -3,6 +3,7 @@ import Vuex from 'vuex';
import RuleInput from 'ee/approvals/components/mr_edit/rule_input.vue';
import ProjectRules from 'ee/approvals/components/project_settings/project_rules.vue';
import RuleName from 'ee/approvals/components/rule_name.vue';
import Rules from 'ee/approvals/components/rules.vue';
import UnconfiguredSecurityRules from 'ee/approvals/components/security_configuration/unconfigured_security_rules.vue';
import { createStoreOptions } from 'ee/approvals/stores';
import projectSettingsModule from 'ee/approvals/stores/modules/project_settings';
......@@ -57,7 +58,10 @@ describe('Approvals ProjectRules', () => {
it('renders row for each rule', () => {
factory();
const rows = wrapper.findAll('tbody tr').filter((tr, index) => index !== 0);
const rows = wrapper
.findComponent(Rules)
.findAll('tbody tr')
.filter((tr, index) => index !== 0);
const data = rows.wrappers.map(getRowData);
expect(data).toEqual(
......@@ -68,7 +72,7 @@ describe('Approvals ProjectRules', () => {
})),
);
expect(wrapper.findAll(RuleName).length).toBe(rows.length);
expect(wrapper.findComponent(Rules).findAll(RuleName).length).toBe(rows.length);
});
it('should always have any_approver rule', () => {
......@@ -91,12 +95,12 @@ describe('Approvals ProjectRules', () => {
factory();
row = wrapper.find('tbody tr');
row = wrapper.findComponent(Rules).find('tbody tr');
});
it('does not render name', () => {
expect(findCell(row, 'name').exists()).toBe(false);
expect(wrapper.find(RuleName).exists()).toBe(false);
expect(wrapper.findComponent(Rules).find(RuleName).exists()).toBe(false);
});
it('should only display 1 rule', () => {
......@@ -116,7 +120,7 @@ describe('Approvals ProjectRules', () => {
beforeEach(() => {
factory();
rows = wrapper.findAll('tbody tr');
rows = wrapper.find(Rules).findAll('tbody tr');
});
it('should not render the popover for a standard approval group', () => {
......@@ -126,35 +130,23 @@ describe('Approvals ProjectRules', () => {
expect(nameCell.find('.js-help').exists()).toBeFalsy();
});
it('should not render the unconfigured-security-rules component', () => {
expect(wrapper.find(UnconfiguredSecurityRules).exists()).toBe(false);
it('should render the unconfigured-security-rules component', () => {
expect(wrapper.find(UnconfiguredSecurityRules).exists()).toBe(true);
});
});
describe.each([true, false])(
'when the approvalSuggestions feature flag is %p',
(approvalSuggestions) => {
beforeEach(() => {
const rules = createProjectRules();
rules[0].name = 'Vulnerability-Check';
store.modules.approvals.state.rules = rules;
store.state.settings.allowMultiRule = true;
factory(
{},
{
provide: {
glFeatures: { approvalSuggestions },
},
},
);
});
it(`should ${
approvalSuggestions ? '' : 'not'
} render the unconfigured-security-rules component`, () => {
expect(wrapper.find(UnconfiguredSecurityRules).exists()).toBe(approvalSuggestions);
});
},
);
describe('approval suggestions', () => {
beforeEach(() => {
const rules = createProjectRules();
rules[0].name = 'Vulnerability-Check';
store.modules.approvals.state.rules = rules;
store.state.settings.allowMultiRule = true;
factory();
});
it(`should render the unconfigured-security-rules component`, () => {
expect(wrapper.find(UnconfiguredSecurityRules).exists()).toBe(true);
});
});
});
......@@ -534,7 +534,7 @@ describe('EE Approvals RuleForm', () => {
});
});
describe('with approvalSuggestions enabled', () => {
describe('with approval suggestions', () => {
describe.each`
defaultRuleName | expectedDisabledAttribute
${'Vulnerability-Check'} | ${'disabled'}
......@@ -544,17 +544,10 @@ describe('EE Approvals RuleForm', () => {
'with defaultRuleName set to $defaultRuleName',
({ defaultRuleName, expectedDisabledAttribute }) => {
beforeEach(() => {
createComponent(
{
initRule: null,
defaultRuleName,
},
{
provide: {
glFeatures: { approvalSuggestions: true },
},
},
);
createComponent({
initRule: null,
defaultRuleName,
});
});
it(`it ${
......
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