mirror of
https://github.com/funamitech/mastodon
synced 2024-12-14 22:59:46 +09:00
7d7db8977b
Port d27216dc46
to glitch-soc
17 lines
471 B
JavaScript
17 lines
471 B
JavaScript
import { Map as ImmutableMap, fromJS } from 'immutable';
|
|
|
|
import { POLLS_IMPORT } from 'flavours/glitch/actions/importer';
|
|
|
|
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;
|
|
}
|
|
}
|