about summary refs log tree commit diff
path: root/app/javascript/mastodon/reducers/custom_emojis.js
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2017-09-23 14:47:32 +0200
committerGitHub <noreply@github.com>2017-09-23 14:47:32 +0200
commit1e02ba111ae38ab758135b5b2b46f34c672ca02e (patch)
tree62c916782bf9340837a12fcb0c79bb9d481b4ce8 /app/javascript/mastodon/reducers/custom_emojis.js
parent66126f302167d21e4bf247e660f595ff0beaaf20 (diff)
Add emoji autosuggest (#5053)
* Add emoji autosuggest

Some credit goes to glitch-soc/mastodon#149

* Remove server-side shortcode->unicode conversion

* Insert shortcode when suggestion is custom emoji

* Remove remnant of server-side emojis

* Update style of autosuggestions

* Fix wrong emoji filenames generated in autosuggest item

* Do not lazy load emoji picker, as that no longer works

* Fix custom emoji autosuggest

* Fix multiple "Custom" categories getting added to emoji index, only add once
Diffstat (limited to 'app/javascript/mastodon/reducers/custom_emojis.js')
-rw-r--r--app/javascript/mastodon/reducers/custom_emojis.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/app/javascript/mastodon/reducers/custom_emojis.js b/app/javascript/mastodon/reducers/custom_emojis.js
index 15bba7bcc..d80c0d156 100644
--- a/app/javascript/mastodon/reducers/custom_emojis.js
+++ b/app/javascript/mastodon/reducers/custom_emojis.js
@@ -1,11 +1,14 @@
 import { List as ImmutableList } from 'immutable';
 import { STORE_HYDRATE } from '../actions/store';
+import { emojiIndex } from 'emoji-mart';
+import { buildCustomEmojis } from '../emoji';
 
 const initialState = ImmutableList();
 
-export default function statuses(state = initialState, action) {
+export default function custom_emojis(state = initialState, action) {
   switch(action.type) {
   case STORE_HYDRATE:
+    emojiIndex.search('', { custom: buildCustomEmojis(action.state.get('custom_emojis', [])) });
     return action.state.get('custom_emojis');
   default:
     return state;