diff options
author | multiple creatures <dev@multiple-creature.party> | 2020-01-12 23:56:43 -0600 |
---|---|---|
committer | multiple creatures <dev@multiple-creature.party> | 2020-01-12 23:56:43 -0600 |
commit | 51bab85b07b1433e832152f6498f203ec4b4434d (patch) | |
tree | 3c3e3a5cf92e03956195ef7a4e11f25e10f7b3ad /app/policies | |
parent | 651c569c3fe7bd3ab12578396ec5934285f02188 (diff) |
add privacy option to limit lifespan of public access to post & object urls beyond local followers, default to 90 days
Diffstat (limited to 'app/policies')
-rw-r--r-- | app/policies/status_policy.rb | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/app/policies/status_policy.rb b/app/policies/status_policy.rb index 0961ec3e2..f23d089d4 100644 --- a/app/policies/status_policy.rb +++ b/app/policies/status_policy.rb @@ -13,13 +13,12 @@ class StatusPolicy < ApplicationPolicy def show? return false if local_only? && (current_account.nil? || !current_account.local?) + return true if owned? || mention_exists? - if direct? - owned? || mention_exists? - elsif private? - owned? || following_author? || mention_exists? + if private? + following_author? && still_accessible? else - current_account.nil? || !author_blocking? + author_allows_anon? && still_accessible? && !author_blocking? && (author_not_invisible? || following_author?) end end @@ -90,4 +89,16 @@ class StatusPolicy < ApplicationPolicy def local_only? record.local_only? end + + def still_accessible? + record.created_at > record.account.user.max_public_access.to_i.days.ago + end + + def author_allows_anon? + (!current_account.nil? && user_signed_in?) || !record.account.block_anon + end + + def author_not_invisible? + !record.account.hidden? + end end |