home_feed.rb 590 B

12345678910111213141516171819202122232425
  1. # frozen_string_literal: true
  2. class HomeFeed < Feed
  3. def initialize(account)
  4. @type = :home
  5. @id = account.id
  6. @account = account
  7. end
  8. def get(limit, max_id = nil, since_id = nil)
  9. if redis.exists("account:#{@account.id}:regeneration")
  10. from_database(limit, max_id, since_id)
  11. else
  12. super
  13. end
  14. end
  15. private
  16. def from_database(limit, max_id, since_id)
  17. Status.as_home_timeline(@account)
  18. .paginate_by_max_id(limit, max_id, since_id)
  19. .reject { |status| FeedManager.instance.filter?(:home, status, @account.id) }
  20. end
  21. end