about summary refs log tree commit diff
path: root/app/models/status.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/status.rb')
-rw-r--r--app/models/status.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/app/models/status.rb b/app/models/status.rb
index ab68f4e69..142dec64e 100644
--- a/app/models/status.rb
+++ b/app/models/status.rb
@@ -102,21 +102,25 @@ class Status < ApplicationRecord
       where(account: [account] + account.following)
     end
 
-    def as_public_timeline(account = nil)
+    def as_public_timeline(account = nil, local_only = false)
       query = joins('LEFT OUTER JOIN accounts ON statuses.account_id = accounts.id')
               .where(visibility: :public)
               .where('(statuses.in_reply_to_id IS NULL OR statuses.in_reply_to_account_id = statuses.account_id)')
               .where('statuses.reblog_of_id IS NULL')
 
+      query = query.where('accounts.domain IS NULL') if local_only
+
       account.nil? ? filter_timeline_default(query) : filter_timeline_default(filter_timeline(query, account))
     end
 
-    def as_tag_timeline(tag, account = nil)
+    def as_tag_timeline(tag, account = nil, local_only = false)
       query = tag.statuses
                  .joins('LEFT OUTER JOIN accounts ON statuses.account_id = accounts.id')
                  .where(visibility: :public)
                  .where('statuses.reblog_of_id IS NULL')
 
+      query = query.where('accounts.domain IS NULL') if local_only
+
       account.nil? ? filter_timeline_default(query) : filter_timeline_default(filter_timeline(query, account))
     end