aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/tweet.rb
diff options
context:
space:
mode:
authorRhenium <rhenium@rhe.jp>2014-03-10 19:32:58 +0900
committerRhenium <rhenium@rhe.jp>2014-03-10 19:32:58 +0900
commitb8f19fefe781620adb8034279bac9dc08f1fbcac (patch)
treec5368acb0e8ea70b9c41d4a7d81469dbfef0696c /app/models/tweet.rb
parente56c678cae491ff594795829d2d98e854a460d26 (diff)
downloadaclog-b8f19fefe781620adb8034279bac9dc08f1fbcac.tar.gz
fix tweets#all_best and tweets#all_recent: don't show not registered user's tweets
Diffstat (limited to 'app/models/tweet.rb')
-rw-r--r--app/models/tweet.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/app/models/tweet.rb b/app/models/tweet.rb
index 3123d25..96795cb 100644
--- a/app/models/tweet.rb
+++ b/app/models/tweet.rb
@@ -13,6 +13,7 @@ class Tweet < ActiveRecord::Base
scope :recent, ->(days = 3) { where("tweets.id > ?", snowflake_min(Time.zone.now - days.days)) }
scope :reacted, ->(count = nil) { where("reactions_count >= ?", (count || 1).to_i) }
scope :not_protected, -> { includes(:user).references(:user).where(users: { protected: false }) }
+ scope :registered, -> { joins(user: :account).references(:account).where(accounts: { status: Account::ACTIVE }) }
scope :max_id, -> id { where("tweets.id <= ?", id.to_i) if id }
scope :since_id, -> id { where("tweets.id > ?", id.to_i) if id }