about summary refs log tree commit diff
path: root/app/assets/javascripts/components/actions/timelines.jsx
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-09-22 01:08:35 +0200
committerEugen Rochko <eugen@zeonfederated.com>2016-09-22 01:08:35 +0200
commit2c0261ac255ace05078a5745a17886084d5f83d0 (patch)
tree4c8372d1d5b14a126d90421ff4a77f4fa077a3d9 /app/assets/javascripts/components/actions/timelines.jsx
parent74dfefabd39c52b47c6f5413568687ee3c76772f (diff)
Infinite scroll for timeline columns
Diffstat (limited to 'app/assets/javascripts/components/actions/timelines.jsx')
-rw-r--r--app/assets/javascripts/components/actions/timelines.jsx37
1 files changed, 37 insertions, 0 deletions
diff --git a/app/assets/javascripts/components/actions/timelines.jsx b/app/assets/javascripts/components/actions/timelines.jsx
index d6de32ea1..8a05c37fd 100644
--- a/app/assets/javascripts/components/actions/timelines.jsx
+++ b/app/assets/javascripts/components/actions/timelines.jsx
@@ -60,3 +60,40 @@ export function refreshTimelineFail(timeline, error) {
     error: error
   };
 };
+
+export function expandTimeline(timeline) {
+  return (dispatch, getState) => {
+    const lastId = getState().getIn(['timelines', timeline]).last();
+
+    dispatch(expandTimelineRequest(timeline));
+
+    api(getState).get(`/api/statuses/${timeline}?max_id=${lastId}`).then(response => {
+      dispatch(expandTimelineSuccess(timeline, response.data));
+    }).catch(error => {
+      dispatch(expandTimelineFail(timeline, error));
+    });
+  };
+};
+
+export function expandTimelineRequest(timeline) {
+  return {
+    type: TIMELINE_EXPAND_REQUEST,
+    timeline: timeline
+  };
+};
+
+export function expandTimelineSuccess(timeline, statuses) {
+  return {
+    type: TIMELINE_EXPAND_SUCCESS,
+    timeline: timeline,
+    statuses: statuses
+  };
+};
+
+export function expandTimelineFail(timeline, error) {
+  return {
+    type: TIMELINE_EXPAND_FAIL,
+    timeline: timeline,
+    error: error
+  };
+};