Skip to content
This repository has been archived by the owner on May 16, 2019. It is now read-only.

Commit

Permalink
Do not trace back timeline
Browse files Browse the repository at this point in the history
  • Loading branch information
rosylilly committed Apr 25, 2019
1 parent 13e0a4f commit 5d1b90b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/models/feed.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ def get(limit, max_id = nil, since_id = nil, min_id = nil)
protected

def from_redis(limit, max_id, since_id, min_id)
# 1ヶ月以上前へ遡ろうとする行為を全面的に禁止
oldest_id = 1.month.ago.to_i * 1000 << 16
max_id = [max_id.to_i, oldest_id].min if max_id.present?
since_id = [since_id.to_i, oldest_id].max if since_id.present?
min_id = [min_id.to_i, oldest_id].max if min_id.present?

if min_id.blank?
max_id = '+inf' if max_id.blank?
since_id = '-inf' if since_id.blank?
Expand Down
6 changes: 6 additions & 0 deletions app/models/home_feed.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ def get(limit, max_id = nil, since_id = nil, min_id = nil)
private

def from_database(limit, max_id, since_id, min_id)
# 1ヶ月以上前へ遡ろうとする行為を全面的に禁止
oldest_id = 1.month.ago.to_i * 1000 << 16
max_id = [max_id.to_i, oldest_id].min if max_id.present?
since_id = [since_id.to_i, oldest_id].max if since_id.present?
min_id = [min_id.to_i, oldest_id].max if min_id.present?

Status.as_home_timeline(@account)
.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) }
Expand Down

0 comments on commit 5d1b90b

Please sign in to comment.