Skip to content
代码片段 群组 项目
提交 4bb8c88e 编辑于 作者: 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
上级 ef71a0ab
No related branches found
No related tags found
无相关合并请求
...@@ -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),
); );
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册