Commit d25b1266 authored by Vitaly Slobodin's avatar Vitaly Slobodin

Merge branch '332890-project-search-sort-based-on-algorithmic-score' into 'master'

Sort by similarity in Search Group's Project dropdown

See merge request gitlab-org/gitlab!64241
parents 3000e386 dd4b1a1b
...@@ -30,7 +30,7 @@ export const fetchProjects = ({ commit, state }, search) => { ...@@ -30,7 +30,7 @@ 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, {}, callback); Api.groupProjects(groupId, search, { order_by: 'similarity' }, 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(() => {
......
...@@ -67,7 +67,14 @@ describe('Global Search Store Actions', () => { ...@@ -67,7 +67,14 @@ describe('Global Search Store Actions', () => {
it('calls Api.groupProjects', () => { it('calls Api.groupProjects', () => {
actions.fetchProjects({ commit: mockCommit, state }); actions.fetchProjects({ commit: mockCommit, state });
expect(Api.groupProjects).toHaveBeenCalled(); expect(Api.groupProjects).toHaveBeenCalledWith(
state.query.group_id,
state.query.search,
{
order_by: 'similarity',
},
expect.any(Function),
);
expect(Api.projects).not.toHaveBeenCalled(); expect(Api.projects).not.toHaveBeenCalled();
}); });
}); });
......
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