about summary refs log tree commit diff
path: root/app/javascript/mastodon/actions/timelines.js
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2018-12-14 01:41:38 +0100
committerEugen Rochko <eugen@zeonfederated.com>2018-12-14 01:41:38 +0100
commitf20c0b8507b72dba9c36a71721113edd31567776 (patch)
tree6ead0a566823495275ea7cfcc1593735a650d4e7 /app/javascript/mastodon/actions/timelines.js
parent6eece70fca4ce79a8c5ff2bffb93d1e56a868e70 (diff)
Fix timeline pagination in the WebUI (#9516)
The `hasMore` property of timelines in redux store was set whenever an API
request returned only one page of results, *even* if the query only requested
newer statuses (using `since_id`), causing `hasMore` to be incorrectly set to
false whenever fetching new toots in a timeline, which happens each time
an account's timeline or media gallery is visited.
Diffstat (limited to 'app/javascript/mastodon/actions/timelines.js')
-rw-r--r--app/javascript/mastodon/actions/timelines.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/app/javascript/mastodon/actions/timelines.js b/app/javascript/mastodon/actions/timelines.js
index 215adc4ea..6e7bd027c 100644
--- a/app/javascript/mastodon/actions/timelines.js
+++ b/app/javascript/mastodon/actions/timelines.js
@@ -74,12 +74,14 @@ export function expandTimeline(timelineId, path, params = {}, done = noOp) {
       params.since_id = timeline.getIn(['items', 0]);
     }
 
+    const isLoadingRecent = !!params.since_id;
+
     dispatch(expandTimelineRequest(timelineId, isLoadingMore));
 
     api(getState).get(path, { params }).then(response => {
       const next = getLinks(response).refs.find(link => link.rel === 'next');
       dispatch(importFetchedStatuses(response.data));
-      dispatch(expandTimelineSuccess(timelineId, response.data, next ? next.uri : null, response.code === 206, isLoadingMore));
+      dispatch(expandTimelineSuccess(timelineId, response.data, next ? next.uri : null, response.code === 206, isLoadingRecent, isLoadingMore));
       done();
     }).catch(error => {
       dispatch(expandTimelineFail(timelineId, error, isLoadingMore));
@@ -112,13 +114,14 @@ export function expandTimelineRequest(timeline, isLoadingMore) {
   };
 };
 
-export function expandTimelineSuccess(timeline, statuses, next, partial, isLoadingMore) {
+export function expandTimelineSuccess(timeline, statuses, next, partial, isLoadingRecent, isLoadingMore) {
   return {
     type: TIMELINE_EXPAND_SUCCESS,
     timeline,
     statuses,
     next,
     partial,
+    isLoadingRecent,
     skipLoading: !isLoadingMore,
   };
 };