Skip to content
Snippets Groups Projects
Commit 5c35fdea authored by John Skarbek's avatar John Skarbek
Browse files

Merge branch '14-7_fix_merge_request_approval_rules' into '14-7-stable-ee'

Revert merge request approval groups behavior

See merge request gitlab-org/security/gitlab!2333
parents 82542cf7 08e3ecce
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -135,15 +135,13 @@ export default {
.then((results) => ({ results }));
},
fetchGroups(term) {
const hasTerm = term.trim().length > 0;
const DEVELOPER_ACCESS_LEVEL = 30;
// Don't includeAll when search is empty. Otherwise, the user could get a lot of garbage choices.
// https://gitlab.com/gitlab-org/gitlab/issues/11566
const includeAll = term.trim().length > 0;
 
return Api.projectGroups(this.projectId, {
return Api.groups(term, {
skip_groups: this.skipGroupIds,
...(hasTerm ? { search: term } : {}),
with_shared: true,
shared_visible_only: true,
shared_min_access_level: DEVELOPER_ACCESS_LEVEL,
all_available: includeAll,
});
},
fetchUsers(term) {
Loading
Loading
Loading
Loading
@@ -73,6 +73,7 @@ describe('Approvals ApproversSelect', () => {
};
 
beforeEach(() => {
jest.spyOn(Api, 'groups').mockResolvedValue(TEST_GROUPS);
jest.spyOn(Api, 'projectGroups').mockResolvedValue(TEST_GROUPS);
jest.spyOn(Api, 'projectUsers').mockReturnValue(Promise.resolve(TEST_USERS));
});
Loading
Loading
@@ -123,12 +124,9 @@ describe('Approvals ApproversSelect', () => {
});
 
it('fetches all available groups', () => {
expect(Api.projectGroups).toHaveBeenCalledWith(TEST_PROJECT_ID, {
expect(Api.groups).toHaveBeenCalledWith(term, {
skip_groups: [],
search: term,
with_shared: true,
shared_visible_only: true,
shared_min_access_level: 30,
all_available: true,
});
});
 
Loading
Loading
@@ -160,11 +158,9 @@ describe('Approvals ApproversSelect', () => {
});
 
it('skips groups and does not fetch all available', () => {
expect(Api.projectGroups).toHaveBeenCalledWith(TEST_PROJECT_ID, {
shared_min_access_level: 30,
shared_visible_only: true,
expect(Api.groups).toHaveBeenCalledWith('', {
skip_groups: skipGroupIds,
with_shared: true,
all_available: false,
});
});
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment