[FIX] Search valid for emoji with dual name (#16887)

pull/17107/head^2
Subham Sahoo 6 years ago committed by GitHub
parent 96969e287a
commit c3673784e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      app/emoji/client/emojiPicker.js

@ -58,9 +58,10 @@ function getEmojisBySearchTerm(searchTerm) {
if (searchRegExp.test(current)) {
const emojiObject = emoji.list[current];
const { emojiPackage } = emojiObject;
const { emojiPackage, shortnames } = emojiObject;
let tone = '';
current = current.replace(/:/g, '');
const alias = shortnames[0] !== undefined ? shortnames[0].replace(/:/g, '') : shortnames[0];
if (actualTone > 0 && emoji.packages[emojiPackage].toneList.hasOwnProperty(emoji)) {
tone = `_tone${ actualTone }`;
@ -71,7 +72,8 @@ function getEmojisBySearchTerm(searchTerm) {
for (const key in emoji.packages[emojiPackage].emojisByCategory) {
if (emoji.packages[emojiPackage].emojisByCategory.hasOwnProperty(key)) {
const contents = emoji.packages[emojiPackage].emojisByCategory[key];
if (contents.indexOf(current) !== -1) {
const searchValArray = alias !== undefined ? alias.replace(/:/g, '').split('_') : alias;
if (contents.indexOf(current) !== -1 || (searchValArray !== undefined && searchValArray.includes(searchTerm))) {
emojiFound = true;
break;
}

Loading…
Cancel
Save