Merge branch 'develop' of git.pleroma.social:pleroma/pleroma into feature/emojireactv...
[akkoma] / lib / pleroma / web / activity_pub / side_effects.ex
index 5049cb54ea2804ce21fd11854c366c3f2965f7d5..bfc2ab845d7aac444c7ce8b8a563e768a6f3cfd9 100644 (file)
@@ -34,6 +34,18 @@ defmodule Pleroma.Web.ActivityPub.SideEffects do
     end
   end
 
+  # Tasks this handles:
+  # - Add reaction to object
+  # - Set up notification
+  def handle(%{data: %{"type" => "EmojiReact"}} = object, meta) do
+    reacted_object = Object.get_by_ap_id(object.data["object"])
+    Utils.add_emoji_reaction_to_object(object, reacted_object)
+
+    Notification.create_notifications(object)
+
+    {:ok, object, meta}
+  end
+
   # Tasks this handles:
   # - Delete and unpins the create activity
   # - Replace object with Tombstone