about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFire Demon <firedemon@creature.cafe>2020-08-18 00:52:17 -0500
committerFire Demon <firedemon@creature.cafe>2020-08-30 05:45:19 -0500
commit5c329014a1c2fdbf34c23d4da994bd96e92b5e81 (patch)
treef7959e81ef09c8ddb0d527f4e3119d6c9778d3bf
parente80898409cf5d343e78ff1cef79f0af077185420 (diff)
[Privacy] Allow forcing local-only posts to be excluded in apply_account_filters and include account filters in own posts
-rw-r--r--app/models/status.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/app/models/status.rb b/app/models/status.rb
index 62f8d2778..68093eb73 100644
--- a/app/models/status.rb
+++ b/app/models/status.rb
@@ -524,7 +524,6 @@ class Status < ApplicationRecord
       visibility = :public if options[:public] || (account.blank? && !target_account.show_unlisted?)
 
       scope = where(visibility: visibility)
-      scope = apply_account_filters(scope, account, **options)
       apply_category_filters(scope, target_account, account, **options)
     end
 
@@ -554,6 +553,8 @@ class Status < ApplicationRecord
     # TODO: Cast cleanup spell.
     # rubocop:disable Metrics/PerceivedComplexity
     def apply_category_filters(query, target_account, account, **options)
+      options[:without_account_filters] ||= target_account.id == account&.id
+      query = apply_account_filters(query, account, **options)
       return query if options[:without_category_filters]
 
       query = query.published unless options[:include_unpublished]
@@ -602,9 +603,9 @@ class Status < ApplicationRecord
 
     def apply_account_filters(query, account, **options)
       return query.not_local_only if account.blank?
-      return (account.local? ? query : query.not_local_only) if options[:without_account_filters]
+      return (!options[:exclude_local_only] && account.local? ? query : query.not_local_only) if options[:without_account_filters]
 
-      query = query.not_local_only unless account.local?
+      query = query.not_local_only unless !options[:exclude_local_only] && account.local?
       query = query.not_hidden_by_account(account)
       query = query.in_chosen_languages(account) if account.chosen_languages.present?
       query