|
|
@ -100,11 +100,24 @@ class FeedManager |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
def populate_feed(account) |
|
|
|
def populate_feed(account) |
|
|
|
prepopulate_limit = FeedManager::MAX_ITEMS / 4 |
|
|
|
added = 0 |
|
|
|
statuses = Status.as_home_timeline(account).order(account_id: :desc).limit(prepopulate_limit) |
|
|
|
limit = FeedManager::MAX_ITEMS / 2 |
|
|
|
statuses.reverse_each do |status| |
|
|
|
max_id = nil |
|
|
|
next if filter_from_home?(status, account) |
|
|
|
|
|
|
|
add_to_feed(:home, account, status) |
|
|
|
loop do |
|
|
|
|
|
|
|
statuses = Status.as_home_timeline(account) |
|
|
|
|
|
|
|
.paginate_by_max_id(limit, max_id) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
break if statuses.empty? |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
statuses.each do |status| |
|
|
|
|
|
|
|
next if filter_from_home?(status, account) |
|
|
|
|
|
|
|
added += 1 if add_to_feed(:home, account, status) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
break unless added.zero? |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
max_id = statuses.last.id |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|