diff options
author | Jack Jennings <jack@standard-library.com> | 2017-05-30 06:16:14 -0700 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2017-05-30 15:16:14 +0200 |
commit | e031fd60ad9ee492fbbda319eaeb213098898d03 (patch) | |
tree | 212e09bc3b785addd5d0c45583b4b4a3ef7042eb /app/policies | |
parent | bc4fad9e22695aae04cf06ada7f1c70887028cde (diff) |
Move status reblog authorization into policy (#3425)
Diffstat (limited to 'app/policies')
-rw-r--r-- | app/policies/status_policy.rb | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/app/policies/status_policy.rb b/app/policies/status_policy.rb index 658ba6d12..41d63fcbc 100644 --- a/app/policies/status_policy.rb +++ b/app/policies/status_policy.rb @@ -9,12 +9,26 @@ class StatusPolicy end def show? - if status.direct_visibility? + if direct? status.account.id == account&.id || status.mentions.where(account: account).exists? - elsif status.private_visibility? + elsif private? status.account.id == account&.id || account&.following?(status.account) || status.mentions.where(account: account).exists? else account.nil? || !status.account.blocking?(account) end end + + def reblog? + !direct? && !private? && show? + end + + private + + def direct? + status.direct_visibility? + end + + def private? + status.private_visibility? + end end |