You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
import { Map as ImmutableMap, fromJS } from 'immutable';
|
|
|
|
|
|
|
|
import { POLLS_IMPORT } from 'mastodon/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;
|
|
|
|
}
|
|
|
|
}
|