Commit bab39a1a authored by Natalia Tepluhina's avatar Natalia Tepluhina

Merge branch '350596_allow_to_choose_all_shared_groups' into 'master'

Skip shared group validation for the approval form

See merge request gitlab-org/gitlab!80655
parents 0116ce66 2c0ebb9c
......@@ -50,6 +50,10 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo
push_frontend_feature_flag(:usage_data_diff_searches, @project, default_enabled: :yaml)
end
before_action do
push_frontend_feature_flag(:permit_all_shared_groups_for_approval, @project, default_enabled: :yaml)
end
around_action :allow_gitaly_ref_name_caching, only: [:index, :show, :discussions]
after_action :log_merge_request_show, only: [:show]
......
---
name: permit_all_shared_groups_for_approval
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/80655
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/352766
milestone: '14.8'
type: development
group: group::source code
default_enabled: false
......@@ -5,6 +5,7 @@ import Api from 'ee/api';
import { renderAvatar } from '~/helpers/avatar_helper';
import { loadCSSFile } from '~/lib/utils/css_utils';
import { __ } from '~/locale';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import { TYPE_USER, TYPE_GROUP } from '../constants';
function addType(type) {
......@@ -54,6 +55,7 @@ function formatResult(result) {
}
export default {
mixins: [glFeatureFlagsMixin()],
props: {
value: {
type: Array,
......@@ -80,6 +82,11 @@ export default {
default: false,
},
},
computed: {
isFeatureEnabled() {
return this.glFeatures.permitAllSharedGroupsForApproval;
},
},
watch: {
value(val) {
if (val.length > 0) {
......@@ -142,7 +149,7 @@ export default {
skip_groups: this.skipGroupIds,
...(hasTerm ? { search: term } : {}),
with_shared: true,
shared_visible_only: true,
shared_visible_only: !this.isFeatureEnabled,
shared_min_access_level: DEVELOPER_ACCESS_LEVEL,
});
},
......
......@@ -61,6 +61,9 @@ describe('Approvals ApproversSelect', () => {
...options,
propsData,
attachTo: document.body,
provide: {
...options.provide,
},
});
await waitForPromises();
......@@ -139,6 +142,34 @@ describe('Approvals ApproversSelect', () => {
});
});
describe('with permitAllSharedGroupsForApproval', () => {
beforeEach(async () => {
await factory({
provide: {
glFeatures: {
permitAllSharedGroupsForApproval: true,
},
},
});
});
it('fetches all available groups including non-visible shared groups', async (done) => {
waitForEvent($input, 'select2-loaded')
.then(jest.runOnlyPendingTimers)
.then(done)
.catch(done.fail);
search();
expect(Api.projectGroups).toHaveBeenCalledWith(TEST_PROJECT_ID, {
skip_groups: [],
with_shared: true,
shared_visible_only: false,
shared_min_access_level: 30,
});
});
});
describe('with empty seach term and skips', () => {
const skipGroupIds = [7, 8];
const skipUserIds = [9, 10];
......
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