2018-04-07 16:05:21 -04:00
|
|
|
import { List as ImmutableList, fromJS as ConvertToImmutable } from 'immutable';
|
2023-05-28 10:38:10 -04:00
|
|
|
|
2023-11-15 06:01:51 -05:00
|
|
|
import { CUSTOM_EMOJIS_FETCH_SUCCESS } from '../actions/custom_emojis';
|
|
|
|
import { buildCustomEmojis } from '../features/emoji/emoji';
|
|
|
|
import { search as emojiSearch } from '../features/emoji/emoji_mart_search_light';
|
2017-09-22 23:40:28 -04:00
|
|
|
|
2018-04-07 16:05:21 -04:00
|
|
|
const initialState = ImmutableList([]);
|
2017-09-22 23:40:28 -04:00
|
|
|
|
2017-09-23 08:47:32 -04:00
|
|
|
export default function custom_emojis(state = initialState, action) {
|
2018-04-07 16:05:21 -04:00
|
|
|
if(action.type === CUSTOM_EMOJIS_FETCH_SUCCESS) {
|
|
|
|
state = ConvertToImmutable(action.custom_emojis);
|
|
|
|
emojiSearch('', { custom: buildCustomEmojis(state) });
|
2017-09-22 23:40:28 -04:00
|
|
|
}
|
2018-04-07 16:05:21 -04:00
|
|
|
|
|
|
|
return state;
|
2023-02-03 14:52:07 -05:00
|
|
|
}
|