]> cat aescling's git repositories - mastodon.git/commitdiff
Fix refreshing featured toots when the new collection is empty (#10971)
authorThibG <thib@sitedethib.com>
Wed, 5 Jun 2019 11:39:59 +0000 (13:39 +0200)
committerEugen Rochko <eugen@zeonfederated.com>
Wed, 5 Jun 2019 11:39:59 +0000 (13:39 +0200)
Fixes #10945

app/javascript/mastodon/reducers/timelines.js

index 6a972f96702ffe32329f099c14d67a0d1171932e..309a95a19b837eeb7dcf85cf0eea406a25833855 100644 (file)
@@ -35,14 +35,12 @@ const expandNormalizedTimeline = (state, timeline, statuses, next, isPartial, is
 
     if (!next && !isLoadingRecent) mMap.set('hasMore', false);
 
-    if (!statuses.isEmpty()) {
+    if (timeline.endsWith(':pinned')) {
+      mMap.set('items', statuses.map(status => status.get('id')));
+    } else if (!statuses.isEmpty()) {
       mMap.update('items', ImmutableList(), oldIds => {
         const newIds = statuses.map(status => status.get('id'));
 
-        if (timeline.indexOf(':pinned') !== -1) {
-          return newIds;
-        }
-
         const lastIndex = oldIds.findLastIndex(id => id !== null && compareId(id, newIds.last()) >= 0) + 1;
         const firstIndex = oldIds.take(lastIndex).findLastIndex(id => id !== null && compareId(id, newIds.first()) > 0);