mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2024-12-23 08:36:29 +00:00
Web.ActivityPub.ActivityPub: assign the Enum.filter to recipients & simplify it
This commit is contained in:
parent
bd9b5fffbc
commit
d2e4eb7c74
1 changed files with 10 additions and 10 deletions
|
@ -19,19 +19,19 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
|
||||||
defp get_recipients(%{"type" => "Announce"} = data) do
|
defp get_recipients(%{"type" => "Announce"} = data) do
|
||||||
to = data["to"] || []
|
to = data["to"] || []
|
||||||
cc = data["cc"] || []
|
cc = data["cc"] || []
|
||||||
recipients = to ++ cc
|
|
||||||
actor = User.get_cached_by_ap_id(data["actor"])
|
actor = User.get_cached_by_ap_id(data["actor"])
|
||||||
|
|
||||||
recipients
|
recipients =
|
||||||
|> Enum.filter(fn recipient ->
|
(to ++ cc)
|
||||||
case User.get_cached_by_ap_id(recipient) do
|
|> Enum.filter(fn recipient ->
|
||||||
nil ->
|
case User.get_cached_by_ap_id(recipient) do
|
||||||
true
|
nil ->
|
||||||
|
true
|
||||||
|
|
||||||
user ->
|
user ->
|
||||||
User.following?(user, actor)
|
User.following?(user, actor)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
{recipients, to, cc}
|
{recipients, to, cc}
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue