Do not store recent if recent category is hidden.

nolan/hinaloe-test
Sam Kelleher 2017-05-25 16:57:03 +01:00
parent 95eff42f8c
commit 184f2824f5
No known key found for this signature in database
GPG Key ID: 482BDE9844A397AC
1 changed files with 4 additions and 1 deletions

View File

@ -58,6 +58,8 @@ export default class Picker extends React.Component {
allCategories.push(CUSTOM_CATEGORY) allCategories.push(CUSTOM_CATEGORY)
} }
this.hideRecent = false
if (props.include != undefined) { if (props.include != undefined) {
data.categories.sort((a, b) => { data.categories.sort((a, b) => {
let aName = a.name.toLowerCase() let aName = a.name.toLowerCase()
@ -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 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 let excludeRecent = props.exclude && props.exclude.length ? props.exclude.indexOf('recent') > -1 : false
if (includeRecent && !excludeRecent) { if (includeRecent && !excludeRecent) {
this.hideRecent = true
this.categories.unshift(RECENT_CATEGORY) this.categories.unshift(RECENT_CATEGORY)
} }
@ -163,7 +166,7 @@ export default class Picker extends React.Component {
handleEmojiClick(emoji, e) { handleEmojiClick(emoji, e) {
this.props.onClick(emoji, e) this.props.onClick(emoji, e)
frequently.add(emoji) if (!this.hideRecent) frequently.add(emoji)
var component = this.refs['category-1'] var component = this.refs['category-1']
if (component) { if (component) {