# - Add like to object
# - Set up notification
def handle(%{data: %{"type" => "Like"}} = object, meta) do
- {:ok, result} =
- Pleroma.Repo.transaction(fn ->
- liked_object = Object.get_by_ap_id(object.data["object"])
- Utils.add_like_to_object(object, liked_object)
+ 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)
-
- result
+ {:ok, object, meta}
end
# Tasks this handles
alias Pleroma.Web.ActivityPub.ObjectValidator
alias Pleroma.Web.ActivityPub.ObjectValidators.LikeValidator
alias Pleroma.Web.ActivityPub.Pipeline
- alias Pleroma.Web.ActivityPub.Transmogrifier.ChatMessageHandling
alias Pleroma.Web.ActivityPub.Utils
alias Pleroma.Web.ActivityPub.Visibility
alias Pleroma.Web.Federator
def handle_incoming(
%{"type" => "Create", "object" => %{"type" => "ChatMessage"}} = data,
- options
- ),
- do: ChatMessageHandling.handle_incoming(data, options)
+ _options
+ ) do
+ case Pipeline.common_pipeline(data, local: false) do
+ {:ok, activity, _} ->
+ {:ok, activity}
+
+ e ->
+ e
+ end
+ end
def handle_incoming(%{"type" => "Like"} = data, _options) do
with {_, {:ok, cast_data_sym}} <-
+++ /dev/null
-# Pleroma: A lightweight social networking server
-# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
-# SPDX-License-Identifier: AGPL-3.0-only
-
-defmodule Pleroma.Web.ActivityPub.Transmogrifier.ChatMessageHandling do
- alias Pleroma.Web.ActivityPub.Pipeline
-
- def handle_incoming(
- %{"type" => "Create", "object" => %{"type" => "ChatMessage"}} = data,
- _options
- ) do
- case Pipeline.common_pipeline(data, local: false) do
- {:ok, activity, _} ->
- {:ok, activity}
-
- e ->
- e
- end
- end
-end