闭社主体 forked from https://github.com/tootsuite/mastodon
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
650 B

  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, min_id = nil)
  9. if redis.exists("account:#{@account.id}:regeneration")
  10. from_database(limit, max_id, since_id, min_id)
  11. else
  12. super
  13. end
  14. end
  15. private
  16. def from_database(limit, max_id, since_id, min_id)
  17. Status.as_home_timeline(@account)
  18. .paginate_by_id(limit, max_id: max_id, since_id: since_id, min_id: min_id)
  19. .reject { |status| FeedManager.instance.filter?(:home, status, @account.id) }
  20. end
  21. end