behave like `block anon` when checking whether local users can read a community or public post made in invisible mode

master
multiple creatures 2020-01-14 02:16:13 -06:00
parent a9c30694cd
commit 0ce978a11d
1 changed files with 3 additions and 7 deletions

View File

@ -19,7 +19,7 @@ class StatusPolicy < ApplicationPolicy
if private?
following_author? && still_accessible?
else
author_allows_anon? && still_accessible? && !author_blocking? && (author_not_invisible? || following_author?)
author_allows_anon? && still_accessible? && !author_blocking? || following_author?
end
end
@ -93,14 +93,10 @@ class StatusPolicy < ApplicationPolicy
def still_accessible?
return true unless record.local?
record.updated_at > record.account.user.max_public_access.to_i.days.ago
record.updated_at > record.account.user.max_public_access.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?
(!current_account.nil? && user_signed_in?) || (!record.account.block_anon && !record.account.hidden)
end
end