]> cat aescling's git repositories - mastodon.git/commitdiff
[Glitch] Fix refreshing featured toots when the new collection is empty
authorThibaut Girka <thib@sitedethib.com>
Fri, 7 Jun 2019 15:05:32 +0000 (17:05 +0200)
committerThibaut Girka <thib@sitedethib.com>
Fri, 7 Jun 2019 15:05:32 +0000 (17:05 +0200)
Port d34a3a2cc72c12ae5119150a8ac18dd8fb7a4e6b to glitch-soc

app/javascript/flavours/glitch/reducers/timelines.js

index cb233de1caf8af43b48d8674ea3cd3a2a2af12fe..440b370e67ad59a42f02b9437c9ce2ef9bf9832c 100644 (file)
@@ -35,7 +35,9 @@ 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'));
         const lastIndex = oldIds.findLastIndex(id => id !== null && compareId(id, newIds.last()) >= 0) + 1;