Commit 4bb8c88e authored by Terri Chu's avatar Terri Chu

Adjust Groups API call used in Search Group Projects select

The Search Group's Project dropdown will no longer include shared
groups and will include subgroup projects when returning results.

Changelog: fixed
parent ef71a0ab
......@@ -32,7 +32,12 @@ export const fetchProjects = ({ commit, state }, search) => {
if (groupId) {
// TODO (https://gitlab.com/gitlab-org/gitlab/-/issues/323331): For errors `createFlash` is called twice; in `callback` and in `Api.groupProjects`
Api.groupProjects(groupId, search, { order_by: 'similarity' }, callback);
Api.groupProjects(
groupId,
search,
{ order_by: 'similarity', with_shared: false, include_subgroups: true },
callback,
);
} else {
// The .catch() is due to the API method not handling a rejection properly
Api.projects(search, { order_by: 'id' }, callback).catch(() => {
......
......@@ -115,7 +115,7 @@ describe('Global Search Store Actions', () => {
});
describe('when groupId is set', () => {
it('calls Api.groupProjects', () => {
it('calls Api.groupProjects with expected parameters', () => {
actions.fetchProjects({ commit: mockCommit, state });
expect(Api.groupProjects).toHaveBeenCalledWith(
......@@ -123,6 +123,8 @@ describe('Global Search Store Actions', () => {
state.query.search,
{
order_by: 'similarity',
include_subgroups: true,
with_shared: false,
},
expect.any(Function),
);
......
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