diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2016-11-09 17:48:44 +0100 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2016-11-09 17:48:44 +0100 |
commit | b13e7dda1f33be43d1667b754b67df71f3187a5c (patch) | |
tree | 62f451e95bb93846744f7bcdc58fcf8dc8d6d6f9 /app/models/feed.rb | |
parent | 8d7fc5da6c880e356e6861b5c5bd564c242c7991 (diff) |
API pagination for all collections using Link header
Diffstat (limited to 'app/models/feed.rb')
-rw-r--r-- | app/models/feed.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/app/models/feed.rb b/app/models/feed.rb index e7a39f5da..408403873 100644 --- a/app/models/feed.rb +++ b/app/models/feed.rb @@ -12,11 +12,13 @@ class Feed # If we're after most recent items and none are there, we need to precompute the feed if unhydrated.empty? && max_id == '+inf' && since_id == '-inf' RegenerationWorker.perform_async(@account.id, @type) - Status.send("as_#{@type}_timeline", @account).paginate_by_max_id(limit, nil, nil) + @statuses = Status.send("as_#{@type}_timeline", @account).paginate_by_max_id(limit, nil, nil) else status_map = Status.where(id: unhydrated).with_includes.with_counters.map { |status| [status.id, status] }.to_h - unhydrated.map { |id| status_map[id] }.compact + @statuses = unhydrated.map { |id| status_map[id] }.compact end + + @statuses end private |