diff options
author | lain <lain@soykaf.club> | 2020-03-31 19:16:45 +0200 |
---|---|---|
committer | lain <lain@soykaf.club> | 2020-03-31 19:16:45 +0200 |
commit | ecac57732a063c1ad01aeb5aa4eb9853b6f904e9 (patch) | |
tree | b0459222894100a1ceb541d046f8f713da36bd5d | |
parent | 51fc504705c1ab337b1202d6e407a9578e67a9e9 (diff) | |
download | pleroma-ecac57732a063c1ad01aeb5aa4eb9853b6f904e9.tar.gz |
Transmogrifier: Only add context if it really is onne.
-rw-r--r-- | lib/pleroma/web/activity_pub/transmogrifier.ex | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/lib/pleroma/web/activity_pub/transmogrifier.ex b/lib/pleroma/web/activity_pub/transmogrifier.ex index a3529f09b..f82142979 100644 --- a/lib/pleroma/web/activity_pub/transmogrifier.ex +++ b/lib/pleroma/web/activity_pub/transmogrifier.ex @@ -1255,14 +1255,11 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do do: {:ok, data} defp maybe_add_context_from_object(%{"object" => object} = data) when is_binary(object) do - if object = Object.normalize(object) do - data = - data - |> Map.put("context", object.data["context"]) - - {:ok, data} + with %{data: %{"context" => context}} when is_binary(context) <- Object.normalize(object) do + {:ok, Map.put(data, "context", context)} else - {:error, "No context on referenced object"} + _ -> + {:error, :no_context} end end |