2017-09-23 06:40:28 +03:00
|
|
|
import { List as ImmutableList } from 'immutable';
|
2017-12-04 09:26:40 +02:00
|
|
|
import { STORE_HYDRATE } from 'flavours/glitch/actions/store';
|
|
|
|
import { search as emojiSearch } from 'flavours/glitch/util/emoji/emoji_mart_search_light';
|
|
|
|
import { buildCustomEmojis } from 'flavours/glitch/util/emoji';
|
2017-09-23 06:40:28 +03:00
|
|
|
|
|
|
|
const initialState = ImmutableList();
|
|
|
|
|
2017-09-23 15:47:32 +03:00
|
|
|
export default function custom_emojis(state = initialState, action) {
|
2017-09-23 06:40:28 +03:00
|
|
|
switch(action.type) {
|
|
|
|
case STORE_HYDRATE:
|
2017-10-31 23:58:07 +02:00
|
|
|
emojiSearch('', { custom: buildCustomEmojis(action.state.get('custom_emojis', [])) });
|
2017-09-23 06:40:28 +03:00
|
|
|
return action.state.get('custom_emojis');
|
|
|
|
default:
|
|
|
|
return state;
|
|
|
|
}
|
|
|
|
};
|