Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/pages/home/report/EmojiPickerMenu/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ class EmojiPickerMenu extends Component {
}

// Move in the prescribed direction until we reach an element that isn't a header
const isHeader = e => e.header || e.code === CONST.EMOJI_SPACER;
const isHeader = e => e.header || e.spacer;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch..

do {
newIndex += steps;
} while (isHeader(this.state.filteredEmojis[newIndex]));
Expand Down Expand Up @@ -343,9 +343,12 @@ class EmojiPickerMenu extends Component {
return;
}

const newFilteredEmojiList = _.filter(this.emojis, emoji => (
// Skip "Frequently Used" emojis to avoid duplicate results.
// Frequently used emojis are on the 0th index category. Hence, slice the array from the 1st index category onwards.
const uniqueEmojis = _.isEmpty(this.props.frequentlyUsedEmojis) ? this.emojis : this.emojis.slice(this.unfilteredHeaderIndices[1] * this.numColumns);
const newFilteredEmojiList = _.filter(uniqueEmojis, emoji => (
!emoji.header
&& emoji.code !== CONST.EMOJI_SPACER
&& !emoji.spacer
&& _.find(emoji.keywords, keyword => keyword.includes(normalizedSearchTerm))
));

Expand Down
3 changes: 1 addition & 2 deletions tests/unit/EmojiRegexTest.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import _ from 'underscore';
import Emoji from '../../assets/emojis';
import CONST from '../../src/CONST';
import * as EmojiUtils from '../../src/libs/EmojiUtils';

describe('EmojiRegexTest', () => {
it('matches all the emojis in the list', () => {
// Given the set of Emojis available in the application
const emojiMatched = _.every(Emoji, (emoji) => {
if (emoji.header === true || emoji.code === CONST.EMOJI_SPACER) {
if (emoji.header === true || emoji.spacer) {
return true;
}

Expand Down