Commit da5b059e authored by Florie Guibert's avatar Florie Guibert

Allow filtering by user reaction on issue boards

Review feedback
parent ee9d1afe
<script> <script>
import { GlFilteredSearchToken } from '@gitlab/ui'; import { GlFilteredSearchToken } from '@gitlab/ui';
import fuzzaldrinPlus from 'fuzzaldrin-plus';
import { mapActions } from 'vuex'; import { mapActions } from 'vuex';
import BoardFilteredSearch from 'ee_else_ce/boards/components/board_filtered_search.vue'; import BoardFilteredSearch from 'ee_else_ce/boards/components/board_filtered_search.vue';
import { BoardType } from '~/boards/constants'; import { BoardType } from '~/boards/constants';
...@@ -128,14 +129,15 @@ export default { ...@@ -128,14 +129,15 @@ export default {
token: EmojiToken, token: EmojiToken,
unique: true, unique: true,
fetchEmojis: (search = '') => { fetchEmojis: (search = '') => {
// TODO: Switch to GraphQL query when backend is ready: https://gitlab.com/gitlab-org/gitlab/-/issues/339694
return axios return axios
.get(`${gon.relative_url_root || ''}/-/autocomplete/award_emojis`) .get(`${gon.relative_url_root || ''}/-/autocomplete/award_emojis`)
.then(({ data }) => { .then(({ data }) => {
if (search) { if (search) {
return { return {
data: data.filter((e) => data: fuzzaldrinPlus.filter(data, search, {
e.name.toLowerCase().includes(search.toLowerCase()), key: ['name'],
), }),
}; };
} }
return { data }; return { data };
......
...@@ -13,7 +13,7 @@ import FilteredSearchBoards from '~/boards/filtered_search_boards'; ...@@ -13,7 +13,7 @@ import FilteredSearchBoards from '~/boards/filtered_search_boards';
import initBoardsFilteredSearch from '~/boards/mount_filtered_search_issue_boards'; import initBoardsFilteredSearch from '~/boards/mount_filtered_search_issue_boards';
import store from '~/boards/stores'; import store from '~/boards/stores';
import toggleFocusMode from '~/boards/toggle_focus'; import toggleFocusMode from '~/boards/toggle_focus';
import { NavigationType, parseBoolean } from '~/lib/utils/common_utils'; import { NavigationType, isLoggedIn, parseBoolean } from '~/lib/utils/common_utils';
import { fullBoardId } from './boards_util'; import { fullBoardId } from './boards_util';
import boardConfigToggle from './config_toggle'; import boardConfigToggle from './config_toggle';
import initNewBoard from './new_board'; import initNewBoard from './new_board';
...@@ -110,7 +110,7 @@ export default () => { ...@@ -110,7 +110,7 @@ export default () => {
}); });
if (gon?.features?.issueBoardsFilteredSearch) { if (gon?.features?.issueBoardsFilteredSearch) {
initBoardsFilteredSearch(apolloProvider, gon.current_user_id > 0); initBoardsFilteredSearch(apolloProvider, isLoggedIn());
} }
mountBoardApp($boardApp); mountBoardApp($boardApp);
......
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