SideEffects: Use less cryptic syntax.
authorlain <lain@soykaf.club>
Wed, 22 Apr 2020 19:21:21 +0000 (21:21 +0200)
committerlain <lain@soykaf.club>
Wed, 22 Apr 2020 19:21:21 +0000 (21:21 +0200)
lib/pleroma/web/activity_pub/side_effects.ex

index a0f71fd889cace170e6fa109ddfb821f0e6b7ee7..5981e754567e0c098340a1c77395b4402c87dc1f 100644 (file)
@@ -15,15 +15,17 @@ defmodule Pleroma.Web.ActivityPub.SideEffects do
   # - Add like to object
   # - Set up notification
   def handle(%{data: %{"type" => "Like"}} = object, meta) do
-    Pleroma.Repo.transaction(fn ->
-      liked_object = Object.get_by_ap_id(object.data["object"])
-      Utils.add_like_to_object(object, liked_object)
+    {:ok, result} =
+      Pleroma.Repo.transaction(fn ->
+        liked_object = Object.get_by_ap_id(object.data["object"])
+        Utils.add_like_to_object(object, liked_object)
 
-      Notification.create_notifications(object)
+        Notification.create_notifications(object)
 
-      {:ok, object, meta}
-    end)
-    |> (fn {:ok, res} -> res end).()
+        {:ok, object, meta}
+      end)
+
+    result
   end
 
   # Nothing to do