Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature filter invalid emojis #133

Merged
merged 3 commits into from
Oct 30, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Filter invalid emojis from recent category
  • Loading branch information
Gargron committed Oct 9, 2017
commit 8df1c418d31b336962eefbc91a846e0f0f079702
7 changes: 6 additions & 1 deletion src/components/category.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down