mastodon/app/javascript/mastodon/reducers/polls.js
Eugen Rochko fd128b9c7a
Fix poll options not rendering text after vote/refresh (#10189)
* Fix poll options not rendering text after vote/refresh

* Fix poll options not showing up on public pages

* Fix code style issue
2019-03-06 05:35:52 +01:00

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;
}
}