Transmogrifier: Only add context if it really is onne.
This commit is contained in:
parent
51fc504705
commit
ecac57732a
@ -1255,14 +1255,11 @@ defp maybe_add_context_from_object(%{"context" => context} = data) when is_binar
|
|||||||
do: {:ok, data}
|
do: {:ok, data}
|
||||||
|
|
||||||
defp maybe_add_context_from_object(%{"object" => object} = data) when is_binary(object) do
|
defp maybe_add_context_from_object(%{"object" => object} = data) when is_binary(object) do
|
||||||
if object = Object.normalize(object) do
|
with %{data: %{"context" => context}} when is_binary(context) <- Object.normalize(object) do
|
||||||
data =
|
{:ok, Map.put(data, "context", context)}
|
||||||
data
|
|
||||||
|> Map.put("context", object.data["context"])
|
|
||||||
|
|
||||||
{:ok, data}
|
|
||||||
else
|
else
|
||||||
{:error, "No context on referenced object"}
|
_ ->
|
||||||
|
{:error, :no_context}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user