Deduplicate emojis even after using multiple matchers

Fixes flarum/core#968.
This commit is contained in:
Franz Liedke 2016-05-28 16:22:31 +09:00
parent dbf82e4641
commit 16f3a09856
2 changed files with 4 additions and 2 deletions

View File

@ -235,7 +235,8 @@ System.register('flarum/emoji/addComposerAutocomplete', ['flarum/extend', 'flaru
var findMatchingEmojis = function findMatchingEmojis(matcher) {
for (var _i = 0; _i < emojiKeys.length && maxSuggestions > 0; _i++) {
if (matcher(emojiKeys[_i])) {
var curEmoji = emojiKeys[_i];
if (matcher(curEmoji) && similarEmoji.indexOf(curEmoji) === -1) {
--maxSuggestions;
similarEmoji.push(emojiKeys[_i]);
}

View File

@ -106,7 +106,8 @@ export default function addComposerAutocomplete() {
const findMatchingEmojis = matcher => {
for (let i = 0; i < emojiKeys.length && maxSuggestions > 0; i++) {
if (matcher(emojiKeys[i])) {
const curEmoji = emojiKeys[i];
if (matcher(curEmoji) && similarEmoji.indexOf(curEmoji) === -1) {
--maxSuggestions;
similarEmoji.push(emojiKeys[i]);
}