Web.ActivityPub.ActivityPub: assign the Enum.filter to recipients & simplify it

This commit is contained in:
Haelwenn (lanodan) Monnier 2019-02-06 21:19:35 +01:00
parent bd9b5fffbc
commit d2e4eb7c74
No known key found for this signature in database
GPG Key ID: D5B7A8E43C997DEE
1 changed files with 10 additions and 10 deletions

View File

@ -19,10 +19,10 @@ 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 =
(to ++ cc)
|> Enum.filter(fn recipient -> |> Enum.filter(fn recipient ->
case User.get_cached_by_ap_id(recipient) do case User.get_cached_by_ap_id(recipient) do
nil -> nil ->