Skip to content
Snippets Groups Projects
Commit d8547e43 authored by Alexandru Mihai's avatar Alexandru Mihai
Browse files

Fixed #1140 added ascii emoji to autocomplete and sorted them

parent 22432bb9
No related branches found
No related tags found
No related merge requests found
......@@ -116,12 +116,14 @@ Template.messagePopupConfig.helpers
getInput: self.getInput
getFilter: (collection, filter) ->
results = []
key = ':' + filter
# show common used emojis, when use input a single ':'
if filter == ''
commonEmojis = [
':laughing:',
':smiley:',
':stuck_out_tongue:',
':sunglasses:',
':wink:',
':innocent:',
......@@ -137,18 +139,29 @@ Template.messagePopupConfig.helpers
data: collection[shortname]
return results;
for shortname, data of collection
if shortname.indexOf(filter) > -1
# use ascii
for shortname, value of RocketChat.emoji.asciiList
if results.length > 10
break
if shortname.startsWith(key)
results.push
_id: shortname
data: data
data: [value]
# use shortnames
for shortname, data of collection
if results.length > 10
break
if filter.length >= 3
results.sort (a, b) ->
a.length > b.length
if shortname.startsWith(key)
results.push
_id: shortname
data: data
#if filter.length >= 3
results.sort (a, b) ->
a._id.length - b._id.length
return results
......@@ -167,4 +180,3 @@ Template.messagePopupConfig.onCreated ->
@autorun ->
template.channelSubscription = template.subscribe 'channelAutocomplete', template.channelFilter.get()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment