about summary refs log tree commit diff
path: root/app/models/status.rb
diff options
context:
space:
mode:
authorFire Demon <firedemon@creature.cafe>2020-07-18 23:59:04 -0500
committerFire Demon <firedemon@creature.cafe>2020-08-30 05:43:08 -0500
commitdc5526f4ae8c9d3a6f132b2bc72914b95e5286cc (patch)
tree511631c5b0b87d0b8c4dae207af03aa80d54be73 /app/models/status.rb
parentc6ede2d0eef48df6f9a70bb9c2036d688bda35af (diff)
[Privacy, Federation, UI] Add options to allow Fediverse users to decide whether to include replies and unlisted posts on their profiles
Diffstat (limited to 'app/models/status.rb')
-rw-r--r--app/models/status.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/app/models/status.rb b/app/models/status.rb
index bee7d1e67..54023c24c 100644
--- a/app/models/status.rb
+++ b/app/models/status.rb
@@ -390,8 +390,8 @@ class Status < ApplicationRecord
       end
     end
 
-    def permitted_for(target_account, account)
-      visibility = [:public, :unlisted]
+    def permitted_for(target_account, account, user_signed_in: false)
+      visibility = user_signed_in || target_account.show_unlisted? ? [:public, :unlisted] : :public
 
       if account.nil?
         where(visibility: visibility).not_local_only
@@ -402,7 +402,7 @@ class Status < ApplicationRecord
       else
         # followers can see followers-only stuff, but also things they are mentioned in.
         # non-followers can see everything that isn't private/direct, but can see stuff they are mentioned in.
-        visibility.push(:private) if account.following?(target_account)
+        visibility.push(:private) if account.following?(target_account) && (user_signed_in || target_account.show_unlisted?)
 
         scope = left_outer_joins(:reblog)