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