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.

15 lines
463 B

  1. import { POLLS_IMPORT } from 'mastodon/actions/importer';
  2. import { Map as ImmutableMap, fromJS } from 'immutable';
  3. const importPolls = (state, polls) => state.withMutations(map => polls.forEach(poll => map.set(poll.id, fromJS(poll))));
  4. const initialState = ImmutableMap();
  5. export default function polls(state = initialState, action) {
  6. switch(action.type) {
  7. case POLLS_IMPORT:
  8. return importPolls(state, action.polls);
  9. default:
  10. return state;
  11. }
  12. }