Move status reblog authorization into policy (#3425)
This commit is contained in:
committed by
Eugen Rochko
parent
bc4fad9e22
commit
e031fd60ad
@ -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
|
||||
|
Reference in New Issue
Block a user