Merge pull request #133 from Gargron/feature-filter-invalid-emojis [Fix #134]

Feature filter invalid emojis
release
Etienne Lemay 2017-10-30 17:19:46 -04:00 committed by GitHub
commit 35c05eb62d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View File

@ -2,6 +2,7 @@ import React from 'react'
import PropTypes from 'prop-types'
import frequently from '../utils/frequently'
import { getData } from '../utils'
import { Emoji } from '.'
export default class Category extends React.Component {
@ -107,7 +108,11 @@ export default class Category extends React.Component {
}
return id
})
}).filter(id => !!getData(id))
}
if (emojis.length === 0 && frequentlyUsed.length > 0) {
return null;
}
}

View File

@ -78,6 +78,8 @@ function getData(emoji, skin, set) {
if (data.emojis.hasOwnProperty(emoji)) {
emojiData = data.emojis[emoji]
} else {
return null
}
} else if (emoji.id) {
if (data.short_names.hasOwnProperty(emoji.id)) {