diff options
Diffstat (limited to 'app/assets/javascripts/components/actions/timelines.jsx')
-rw-r--r-- | app/assets/javascripts/components/actions/timelines.jsx | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/app/assets/javascripts/components/actions/timelines.jsx b/app/assets/javascripts/components/actions/timelines.jsx index 831065feb..01eee1712 100644 --- a/app/assets/javascripts/components/actions/timelines.jsx +++ b/app/assets/javascripts/components/actions/timelines.jsx @@ -21,17 +21,29 @@ export function refreshTimelineSuccess(timeline, statuses, replace) { }; export function updateTimeline(timeline, status) { - return { - type: TIMELINE_UPDATE, - timeline: timeline, - status: status + return (dispatch, getState) => { + const references = status.reblog ? getState().get('statuses').filter((item, itemId) => (itemId === status.reblog.id || item.get('reblog') === status.reblog.id)).map((_, itemId) => itemId) : []; + + dispatch({ + type: TIMELINE_UPDATE, + timeline, + status, + references + }); }; }; export function deleteFromTimelines(id) { - return { - type: TIMELINE_DELETE, - id: id + return (dispatch, getState) => { + const accountId = getState().getIn(['statuses', id, 'account']); + const references = getState().get('statuses').filter(status => status.get('reblog') === id).map(status => [status.get('id'), status.get('account')]); + + dispatch({ + type: TIMELINE_DELETE, + id, + accountId, + references + }); }; }; |