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

Do not store recently used if 'recent' category is excluded. #83

Merged
merged 3 commits into from May 29, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/components/picker.js
Expand Up @@ -58,6 +58,8 @@ export default class Picker extends React.Component {
allCategories.push(CUSTOM_CATEGORY)
}

this.hideRecent = true

if (props.include != undefined) {
data.categories.sort((a, b) => {
let aName = a.name.toLowerCase()
Expand Down Expand Up @@ -101,6 +103,7 @@ export default class Picker extends React.Component {
let includeRecent = props.include && props.include.length ? props.include.indexOf('recent') > -1 : true
let excludeRecent = props.exclude && props.exclude.length ? props.exclude.indexOf('recent') > -1 : false
if (includeRecent && !excludeRecent) {
this.hideRecent = false
this.categories.unshift(RECENT_CATEGORY)
}

Expand Down Expand Up @@ -163,7 +166,7 @@ export default class Picker extends React.Component {

handleEmojiClick(emoji, e) {
this.props.onClick(emoji, e)
frequently.add(emoji)
if (!this.hideRecent) frequently.add(emoji)

var component = this.refs['category-1']
if (component) {
Expand Down