commit: 122f5af67c966227be9a219d8841db7bc2ef151a
parent b012bfab5a6640bb6bdec78688ca7dd3dd54aee9
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Mon, 1 Mar 2021 22:02:07 +0100
Revert "Transmogrifier: Check object/activity existance for incoming Delete/Undo"
This reverts commit 686453917fdbea9cd23c3d7ba73af8f888b07286.
Diffstat:
1 file changed, 5 insertions(+), 12 deletions(-)
diff --git a/lib/pleroma/web/activity_pub/transmogrifier.ex b/lib/pleroma/web/activity_pub/transmogrifier.ex
@@ -514,13 +514,10 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
%{"type" => "Delete"} = data,
_options
) do
- with {_, %Object{}} <- {:normalize, Object.normalize(data["object"], false)},
- {:ok, activity, _} <- Pipeline.common_pipeline(data, local: false) do
+ with {:ok, activity, _} <-
+ Pipeline.common_pipeline(data, local: false) do
{:ok, activity}
else
- {:normalize, nil} ->
- {:error, "Unknown object to Delete"}
-
{:error, {:validate, _}} = e ->
# Check if we have a create activity for this
with {:ok, object_id} <- ObjectValidators.ObjectID.cast(data["object"]),
@@ -558,17 +555,13 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
def handle_incoming(
%{
"type" => "Undo",
- "object" => %{"type" => type, "id" => act_id}
+ "object" => %{"type" => type}
} = data,
_options
)
when type in ["Like", "EmojiReact", "Announce", "Block"] do
- with {_, %Activity{}} <- {:normalize, Activity.get_by_id(act_id)},
- {:ok, activity, _} <- Pipeline.common_pipeline(data, local: false) do
+ with {:ok, activity, _} <- Pipeline.common_pipeline(data, local: false) do
{:ok, activity}
- else
- {:normalize, nil} -> {:error, "Unknown activity to Undo"}
- e -> e
end
end
@@ -586,7 +579,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
|> Map.put("object", data)
|> handle_incoming(options)
else
- nil -> {:error, "Unknown activity to Undo"}
+ _e -> :error
end
end