mirror of
https://github.com/lunaisnotaboy/mastodon.git
synced 2024-11-14 02:42:54 +00:00
94a0149ff3
Port fd128b9c7a
to glitch-soc
16 lines
463 B
JavaScript
16 lines
463 B
JavaScript
import { POLLS_IMPORT } from 'mastodon/actions/importer';
|
|
import { Map as ImmutableMap, fromJS } from 'immutable';
|
|
|
|
const importPolls = (state, polls) => state.withMutations(map => polls.forEach(poll => map.set(poll.id, fromJS(poll))));
|
|
|
|
const initialState = ImmutableMap();
|
|
|
|
export default function polls(state = initialState, action) {
|
|
switch(action.type) {
|
|
case POLLS_IMPORT:
|
|
return importPolls(state, action.polls);
|
|
default:
|
|
return state;
|
|
}
|
|
}
|