Revert skin tone emoji on search code

release
Peder Johnsen 2019-03-23 15:34:46 +00:00
parent 9afc613fee
commit ed241d1d42
3 changed files with 6 additions and 24 deletions

View File

@ -522,7 +522,6 @@ export default class NimblePicker extends React.PureComponent {
ref={this.setSearchRef}
onSearch={this.handleSearch}
data={this.data}
set={set}
i18n={this.i18n}
emojisToShowFilter={emojisToShowFilter}
include={include}

View File

@ -17,7 +17,7 @@ export default class Search extends React.PureComponent {
}
this.data = props.data
this.emojiIndex = new NimbleEmojiIndex(this.data, props.set)
this.emojiIndex = new NimbleEmojiIndex(this.data)
this.setRef = this.setRef.bind(this)
this.clear = this.clear.bind(this)
this.handleKeyUp = this.handleKeyUp.bind(this)

View File

@ -1,15 +1,13 @@
import { getData, getSanitizedData, intersect } from '..'
import { uncompress } from '../data'
import store from '../store'
export default class NimbleEmojiIndex {
constructor(data, set) {
constructor(data) {
if (data.compressed) {
uncompress(data)
}
this.data = data || {}
this.set = set || null
this.originalPool = {}
this.index = {}
this.emojis = {}
@ -22,7 +20,7 @@ export default class NimbleEmojiIndex {
buildIndex() {
for (let emoji in this.data.emojis) {
let emojiData = this.data.emojis[emoji],
{ short_names, emoticons, skin_variations } = emojiData,
{ short_names, emoticons } = emojiData,
id = short_names[0]
if (emoticons) {
@ -35,16 +33,7 @@ export default class NimbleEmojiIndex {
})
}
// If skin variations include them
if (skin_variations) {
this.emojis[id] = {}
for (let skinTone = 1; skinTone <= 6; skinTone++) {
this.emojis[id][skinTone] = getSanitizedData({id: id, skin: skinTone}, skinTone, this.set, this.data)
}
} else {
this.emojis[id] = getSanitizedData(id, null, this.set, this.data)
}
this.emojis[id] = getSanitizedData(id, null, null, this.data)
this.originalPool[id] = emojiData
}
}
@ -81,8 +70,6 @@ export default class NimbleEmojiIndex {
if (this.customEmojisList != custom)
this.addCustomToPool(custom, this.originalPool)
const skinTone = store.get('skin') || 1;
maxResults || (maxResults = 75)
include || (include = [])
exclude || (exclude = [])
@ -92,7 +79,7 @@ export default class NimbleEmojiIndex {
if (value.length) {
if (value == '-' || value == '-1') {
return [this.emojis['-1'][skinTone]]
return [this.emojis['-1']]
}
var values = value.toLowerCase().split(/[\s|,|\-|_]+/),
@ -161,11 +148,7 @@ export default class NimbleEmojiIndex {
let score = subIndex + 1
if (sub == id) score = 0
if (this.emojis[id] && this.emojis[id][skinTone]) {
aIndex.results.push(this.emojis[id][skinTone])
} else {
aIndex.results.push(this.emojis[id])
}
aIndex.pool[id] = emoji
scores[id] = score