about summary refs log tree commit diff
path: root/app/models/public_feed.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/public_feed.rb')
-rw-r--r--app/models/public_feed.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/app/models/public_feed.rb b/app/models/public_feed.rb
index 5e4c3e1ce..2528ef1b6 100644
--- a/app/models/public_feed.rb
+++ b/app/models/public_feed.rb
@@ -8,6 +8,7 @@ class PublicFeed
   # @option [Boolean] :local
   # @option [Boolean] :remote
   # @option [Boolean] :only_media
+  # @option [Boolean] :allow_local_only
   def initialize(account, options = {})
     @account = account
     @options = options
@@ -21,6 +22,7 @@ class PublicFeed
   def get(limit, max_id = nil, since_id = nil, min_id = nil)
     scope = public_scope
 
+    scope.merge!(without_local_only_scope) unless allow_local_only?
     scope.merge!(without_replies_scope) unless with_replies?
     scope.merge!(without_reblogs_scope) unless with_reblogs?
     scope.merge!(local_only_scope) if local_only?
@@ -35,6 +37,10 @@ class PublicFeed
 
   attr_reader :account, :options
 
+  def allow_local_only?
+    local_account? && (local_only? || options[:allow_local_only])
+  end
+
   def with_reblogs?
     options[:with_reblogs]
   end
@@ -55,6 +61,10 @@ class PublicFeed
     account.present?
   end
 
+  def local_account?
+    account&.local?
+  end
+
   def media_only?
     options[:only_media]
   end
@@ -83,6 +93,10 @@ class PublicFeed
     Status.joins(:media_attachments).group(:id)
   end
 
+  def without_local_only_scope
+    Status.not_local_only
+  end
+
   def account_filters_scope
     Status.not_excluded_by_account(account).tap do |scope|
       scope.merge!(Status.not_domain_blocked_by_account(account)) unless local_only?