Commit f8645813 authored by Olena Horal-Koretska's avatar Olena Horal-Koretska

Merge branch...

Merge branch '336090-search-group-s-project-dropdown-shows-projects-not-in-selected-group' into 'master'

Fix: Search Group's Project select includes shared groups

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