Updated home_feed.rb as_home_timeline to include max_id

• Updated:
- home_feed.rb as_home_timeline to include max_id
- if no max_id (its the initial page load) then query only between now - 60 days
- else, dont add the date restraint
This commit is contained in:
mgabdev 2020-05-21 23:48:05 -04:00
parent 3c310c457b
commit 78c8100768
2 changed files with 7 additions and 7 deletions

View File

@ -18,7 +18,7 @@ class HomeFeed < Feed
private
def from_database(limit, max_id, since_id, min_id)
Status.as_home_timeline(@account)
Status.as_home_timeline(@account, max_id)
.paginate_by_id(limit, max_id: max_id, since_id: since_id, min_id: min_id)
.reject { |status| FeedManager.instance.filter?(:home, status, @account.id) }
end

View File

@ -290,14 +290,14 @@ class Status < ApplicationRecord
where(language: nil).or where(language: account.chosen_languages)
end
def as_home_timeline(account)
def as_home_timeline(account, max_id)
query = where(account: [account] + account.following).without_replies
# if account.user.allows_group_in_home_feed?
# query = query.or(where(group: account.groups))
# end
query.where(visibility: [:public, :unlisted, :private])
if max_id.nil?
query.where('updated_at > ?', 60.days.ago)
else
query
end
end
def as_group_timeline(group)