about summary refs log tree commit diff
path: root/app/models
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-10-19 18:20:19 +0200
committerEugen Rochko <eugen@zeonfederated.com>2016-10-19 18:20:19 +0200
commit04bbc576906ff70feed7d42fef0e6db17fdd9ed3 (patch)
tree789e41ff1abc26044dd230ca05b0aa517e98c453 /app/models
parent8698cd3281ac1d699c723a151b14f1e2f2e8b07e (diff)
Fix #100 - Add "back" button to certain views
Also fix reloading of timelines after merge-type events
Diffstat (limited to 'app/models')
-rw-r--r--app/models/feed.rb5
1 files changed, 2 insertions, 3 deletions
diff --git a/app/models/feed.rb b/app/models/feed.rb
index 4466ea14e..2bc9e980a 100644
--- a/app/models/feed.rb
+++ b/app/models/feed.rb
@@ -8,13 +8,12 @@ class Feed
     max_id     = '+inf' if max_id.blank?
     since_id   = '-inf' if since_id.blank?
     unhydrated = redis.zrevrangebyscore(key, "(#{max_id}", "(#{since_id}", limit: [0, limit], with_scores: true).collect(&:last).map(&:to_i)
-    status_map = {}
 
     # If we're after most recent items and none are there, we need to precompute the feed
-    if unhydrated.empty? && max_id == '+inf'
+    if unhydrated.empty? && max_id == '+inf' && since_id == '-inf'
       PrecomputeFeedService.new.call(@type, @account, limit)
     else
-      Status.where(id: unhydrated).with_includes.with_counters.each { |status| status_map[status.id] = status }
+      status_map = Status.where(id: unhydrated).with_includes.with_counters.map { |status| [status.id, status] }.to_h
       unhydrated.map { |id| status_map[id] }.compact
     end
   end