about summary refs log tree commit diff
path: root/app/models
diff options
context:
space:
mode:
authorFire Demon <firedemon@creature.cafe>2020-08-20 06:12:37 -0500
committerFire Demon <firedemon@creature.cafe>2020-08-30 05:45:19 -0500
commita1d1ee39f79c5bd836dffa676c938c1d2c5e79ec (patch)
treefa1f5ea5f5d1ffcde4112c0b2228a899c0adf888 /app/models
parent00d24f263fe54e5f7ccf785666254232ebb07085 (diff)
[Privacy] Choose random local follower for private fetches instead of first
Diffstat (limited to 'app/models')
-rw-r--r--app/models/account.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/app/models/account.rb b/app/models/account.rb
index dab091bae..aad6dc728 100644
--- a/app/models/account.rb
+++ b/app/models/account.rb
@@ -120,6 +120,7 @@ class Account < ApplicationRecord
   scope :by_domain_and_subdomains, ->(domain) { where(domain: domain).or(where(arel_table[:domain].matches('%.' + domain))) }
   scope :not_excluded_by_account, ->(account) { where.not(id: account.excluded_from_timeline_account_ids) }
   scope :not_domain_blocked_by_account, ->(account) { where(arel_table[:domain].eq(nil).or(arel_table[:domain].not_in(account.excluded_from_timeline_domains))) }
+  scope :random, -> { reorder(Arel.sql('RANDOM()')).limit(1) }
 
   delegate :email,
            :unconfirmed_email,