Commit 558ffabb authored by Olena Horal-Koretska's avatar Olena Horal-Koretska

Merge branch 'ss/add-user-top' into 'master'

Add user to top of filtered search in epics

See merge request gitlab-org/gitlab!65608
parents 8842a769 a2ef287d
<script>
import BoardFilteredSearch from '~/boards/components/board_filtered_search.vue';
import { TYPE_USER } from '~/graphql_shared/constants';
import { convertToGraphQLId } from '~/graphql_shared/utils';
import { __ } from '~/locale';
import AuthorToken from '~/vue_shared/components/filtered_search_bar/tokens/author_token.vue';
import LabelToken from '~/vue_shared/components/filtered_search_bar/tokens/label_token.vue';
......@@ -46,6 +48,7 @@ export default {
token: AuthorToken,
unique: true,
fetchAuthors: this.fetchAuthors,
preloadedAuthors: this.preloadedAuthors(),
},
];
},
......@@ -75,6 +78,18 @@ export default {
})
.then(({ data }) => data.group?.labels.nodes || []);
},
preloadedAuthors() {
return gon?.current_user_id
? [
{
id: convertToGraphQLId(TYPE_USER, gon.current_user_id),
name: gon.current_user_fullname,
username: gon.current_username,
avatarUrl: gon.current_user_avatar_url,
},
]
: [];
},
},
};
</script>
......
......@@ -16,6 +16,13 @@ describe('EpicFilteredSearch', () => {
});
};
window.gon = {
current_user_id: '4',
current_username: 'root',
current_user_avatar_url: 'url',
current_user_fullname: 'Admin',
};
afterEach(() => {
wrapper.destroy();
});
......@@ -56,6 +63,9 @@ describe('EpicFilteredSearch', () => {
token: AuthorToken,
unique: true,
fetchAuthors: wrapper.vm.fetchAuthors,
preloadedAuthors: [
{ id: 'gid://gitlab/User/4', name: 'Admin', username: 'root', avatarUrl: 'url' },
],
},
];
expect(wrapper.find(BoardFilteredSearch).props('tokens')).toEqual(tokens);
......
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