2018-04-05 06:25:34 +10:00
|
|
|
import { List as ImmutableList, fromJS as ConvertToImmutable } from 'immutable';
|
|
|
|
import { CUSTOM_EMOJIS_FETCH_SUCCESS } from '../actions/custom_emojis';
|
2017-10-06 12:42:34 +11:00
|
|
|
import { search as emojiSearch } from '../features/emoji/emoji_mart_search_light';
|
|
|
|
import { buildCustomEmojis } from '../features/emoji/emoji';
|
2017-09-23 13:40:28 +10:00
|
|
|
|
2018-04-05 06:25:34 +10:00
|
|
|
const initialState = ImmutableList([]);
|
2017-09-23 13:40:28 +10:00
|
|
|
|
2017-09-23 22:47:32 +10:00
|
|
|
export default function custom_emojis(state = initialState, action) {
|
2018-04-05 06:25:34 +10:00
|
|
|
if(action.type === CUSTOM_EMOJIS_FETCH_SUCCESS) {
|
|
|
|
state = ConvertToImmutable(action.custom_emojis);
|
|
|
|
emojiSearch('', { custom: buildCustomEmojis(state) });
|
2017-09-23 13:40:28 +10:00
|
|
|
}
|
2018-04-05 06:25:34 +10:00
|
|
|
|
|
|
|
return state;
|
2022-12-19 02:51:37 +11:00
|
|
|
}
|