Filter invalid emojis from recent category

release
Eugen Rochko 2017-10-09 20:23:28 +02:00
parent e4ec409fc7
commit 8df1c418d3
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)) {