about summary refs log tree commit diff
path: root/app/javascript
diff options
context:
space:
mode:
authorNolan Lawson <nolan@nolanlawson.com>2017-10-06 03:03:13 -0700
committerEugen Rochko <eugen@zeonfederated.com>2017-10-06 12:03:13 +0200
commit72d939b69fca9443038d89815ca5356319f42c43 (patch)
tree23f66df7119610df926034de05263be660f1f5bc /app/javascript
parent97b3d0cd567ff5b38343796a5e662087bd45d710 (diff)
Fix thinking_face emoji autocomplete (#5238)
Diffstat (limited to 'app/javascript')
-rw-r--r--app/javascript/mastodon/features/emoji/emoji_utils.js17
1 files changed, 10 insertions, 7 deletions
diff --git a/app/javascript/mastodon/features/emoji/emoji_utils.js b/app/javascript/mastodon/features/emoji/emoji_utils.js
index 6ef2785d9..2742185d9 100644
--- a/app/javascript/mastodon/features/emoji/emoji_utils.js
+++ b/app/javascript/mastodon/features/emoji/emoji_utils.js
@@ -125,13 +125,16 @@ function getData(emoji) {
 }
 
 function intersect(a, b) {
-  let aSet = new Set(a);
-  let bSet = new Set(b);
-  let intersection = new Set(
-    [...aSet].filter(x => bSet.has(x))
-  );
-
-  return Array.from(intersection);
+  let set;
+  let list;
+  if (a.length < b.length) {
+    set = new Set(a);
+    list = b;
+  } else {
+    set = new Set(b);
+    list = a;
+  }
+  return Array.from(new Set(list.filter(x => set.has(x))));
 }
 
 export { getData, getSanitizedData, intersect };