Web.ActivityPub.ActivityPub: assign the Enum.filter to recipients & simplify it
authorHaelwenn (lanodan) Monnier <contact@hacktivis.me>
Wed, 6 Feb 2019 20:19:35 +0000 (21:19 +0100)
committerHaelwenn (lanodan) Monnier <contact@hacktivis.me>
Sat, 9 Feb 2019 13:59:21 +0000 (14:59 +0100)
lib/pleroma/web/activity_pub/activity_pub.ex

index 6028e96a97fe46f8dfe56ad7059946380d96c78d..d22f04bb2f69b3cf0a479c26a39e80b9d78ee7b7 100644 (file)
@@ -19,19 +19,19 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
   defp get_recipients(%{"type" => "Announce"} = data) do
     to = data["to"] || []
     cc = data["cc"] || []
-    recipients = to ++ cc
     actor = User.get_cached_by_ap_id(data["actor"])
 
-    recipients
-    |> Enum.filter(fn recipient ->
-      case User.get_cached_by_ap_id(recipient) do
-        nil ->
-          true
-
-        user ->
-          User.following?(user, actor)
-      end
-    end)
+    recipients =
+      (to ++ cc)
+      |> Enum.filter(fn recipient ->
+        case User.get_cached_by_ap_id(recipient) do
+          nil ->
+            true
+
+          user ->
+            User.following?(user, actor)
+        end
+      end)
 
     {recipients, to, cc}
   end