FIX: emoji search was not finding aliases

This commit is contained in:
Joffrey JAFFEUX 2018-03-01 12:11:52 +01:00 committed by GitHub
parent c9cb6920dc
commit 7ae1c5a663
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 6 deletions

View File

@ -2,8 +2,7 @@ import { on, observes } from "ember-addons/ember-computed-decorators";
import { findRawTemplate } from "discourse/lib/raw-templates";
import { emojiUrlFor } from "discourse/lib/text";
import KeyValueStore from "discourse/lib/key-value-store";
import { emojis } from "pretty-text/emoji/data";
import { extendedEmojiList, isSkinTonableEmoji } from "pretty-text/emoji";
import { extendedEmojiList, isSkinTonableEmoji, emojiSearch } from "pretty-text/emoji";
const { run } = Ember;
const keyValueStore = new KeyValueStore("discourse_emojis_");
@ -205,10 +204,7 @@ export default Ember.Component.extend({
this.$list.css("visibility", "visible");
} else {
const lowerCaseFilter = this.get("filter").toLowerCase();
const filterableEmojis = emojis.concat(_.keys(extendedEmojiList()));
const filteredCodes = _.filter(filterableEmojis, code => {
return code.indexOf(lowerCaseFilter) > -1;
}).slice(0, 30);
const filteredCodes = emojiSearch(lowerCaseFilter, { maxResults: 30});
this.$results.empty().html(
_.map(filteredCodes, (code) => {
const hasDiversity = isSkinTonableEmoji(code);