1
0
Fork 0
mirror of https://github.com/mastodon/mastodon.git synced 2024-08-20 21:08:15 -07:00
mastodon/app/assets/javascripts/components/reducers/timelines.jsx

18 lines
556 B
React
Raw Normal View History

import { TIMELINE_SET, TIMELINE_UPDATE } from '../actions/timelines';
import Immutable from 'immutable';
const initialState = Immutable.Map();
export default function timelines(state = initialState, action) {
switch(action.type) {
case TIMELINE_SET:
return state.set(action.timeline, Immutable.fromJS(action.statuses));
case TIMELINE_UPDATE:
return state.update(action.timeline, function (list) {
2016-08-24 14:33:46 -07:00
return list.unshift(Immutable.fromJS(action.status));
});
default:
return state;
}
}