2018-04-07 20:05:21 +00:00
|
|
|
import { List as ImmutableList, fromJS as ConvertToImmutable } from 'immutable';
|
|
|
|
import { CUSTOM_EMOJIS_FETCH_SUCCESS } from 'flavours/glitch/actions/custom_emojis';
|
2022-10-11 08:41:15 +00:00
|
|
|
import { search as emojiSearch } from 'flavours/glitch/utils/emoji/emoji_mart_search_light';
|
|
|
|
import { buildCustomEmojis } from 'flavours/glitch/utils/emoji';
|
2017-09-23 03:40:28 +00:00
|
|
|
|
2018-04-07 20:05:21 +00:00
|
|
|
const initialState = ImmutableList([]);
|
2017-09-23 03:40:28 +00:00
|
|
|
|
2017-09-23 12:47:32 +00:00
|
|
|
export default function custom_emojis(state = initialState, action) {
|
2018-04-07 20:05:21 +00:00
|
|
|
if(action.type === CUSTOM_EMOJIS_FETCH_SUCCESS) {
|
|
|
|
state = ConvertToImmutable(action.custom_emojis);
|
|
|
|
emojiSearch('', { custom: buildCustomEmojis(state) });
|
2017-09-23 03:40:28 +00:00
|
|
|
}
|
2018-04-07 20:05:21 +00:00
|
|
|
|
|
|
|
return state;
|
2017-09-23 03:40:28 +00:00
|
|
|
};
|