about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-12-23 01:13:16 +0100
committerEugen Rochko <eugen@zeonfederated.com>2016-12-23 01:13:16 +0100
commit6e064cf715702636bd938dcf46fb1253503dbf04 (patch)
treea49f2515efff4f250043aab824c3a448582f24df
parent26f969665dee822bdea9abbe8061ae42fa610917 (diff)
Fix account timelines bug
-rw-r--r--app/models/status.rb9
1 files changed, 1 insertions, 8 deletions
diff --git a/app/models/status.rb b/app/models/status.rb
index 033ae0529..dc7fc60d7 100644
--- a/app/models/status.rb
+++ b/app/models/status.rb
@@ -31,6 +31,7 @@ class Status < ApplicationRecord
 
   scope :remote, -> { where.not(uri: nil) }
   scope :local, -> { where(uri: nil) }
+  scope :permitted_for, ->(target_account, account) { account&.id == target_account.id || account&.following?(target_account) ? where('1=1') : where.not(visibility: :private) }
 
   cache_associated :account, :media_attachments, :tags, :stream_entry, mentions: :account, reblog: [:account, :stream_entry, :tags, :media_attachments, mentions: :account], thread: :account
 
@@ -128,14 +129,6 @@ class Status < ApplicationRecord
       select('reblog_of_id').where(reblog_of_id: status_ids).where(account_id: account_id).map { |s| [s.reblog_of_id, true] }.to_h
     end
 
-    def permitted_for(target_account, account)
-      if account&.id == target_account.id || account&.following?(target_account)
-        self
-      else
-        where.not(visibility: :private)
-      end
-    end
-
     def reload_stale_associations!(cached_items)
       account_ids = []