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 c8ce1a140..2839da5cb 100644
--- a/app/models/public_feed.rb
+++ b/app/models/public_feed.rb
@@ -8,6 +8,7 @@ class PublicFeed < Feed
   # @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 < Feed
   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?
@@ -33,6 +35,10 @@ class PublicFeed < Feed
 
   private
 
+  def allow_local_only?
+    local_account? && (local_only? || @options[:allow_local_only])
+  end
+
   def with_reblogs?
     @options[:with_reblogs]
   end
@@ -53,6 +59,10 @@ class PublicFeed < Feed
     @account.present?
   end
 
+  def local_account?
+    @account&.local?
+  end
+
   def media_only?
     @options[:only_media]
   end
@@ -81,6 +91,10 @@ class PublicFeed < Feed
     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?