Mark fake activities, revert some error return types for safety
This commit is contained in:
parent
260cb25025
commit
6718ed74c2
3 changed files with 5 additions and 4 deletions
|
@ -19,7 +19,7 @@ def cast(object) when is_binary(object) do
|
|||
|
||||
def cast(%{"id" => object}), do: cast(object)
|
||||
|
||||
def cast(o), do: {:error, o}
|
||||
def cast(_), do: :error
|
||||
|
||||
def dump(data), do: {:ok, data}
|
||||
|
||||
|
|
|
@ -215,7 +215,8 @@ defp prepare_activity_params(data) do
|
|||
"type" => "Create",
|
||||
# Should we seriously keep this attributedTo thing?
|
||||
"actor" => data["actor"] || data["attributedTo"],
|
||||
"object" => data
|
||||
"object" => data,
|
||||
"_akkoma_fake" => true,
|
||||
}
|
||||
|> Maps.put_if_present("to", data["to"])
|
||||
|> Maps.put_if_present("cc", data["cc"])
|
||||
|
|
|
@ -637,10 +637,10 @@ defp handle_incoming_normalised(
|
|||
end
|
||||
end
|
||||
|
||||
defp handle_incoming_normalised(%{"object" => o}, options),
|
||||
defp handle_incoming_normalised(%{"object" => o, "_akkoma_fake" => true}, options),
|
||||
do: handle_incoming_normalised(o, options)
|
||||
|
||||
defp handle_incoming_normalised(o, _), do: {:error, {:unknown_object_class, o}}
|
||||
defp handle_incoming_normalised(o, _), do: :error
|
||||
|
||||
@spec get_obj_helper(String.t(), Keyword.t()) :: {:ok, Object.t()} | nil
|
||||
def get_obj_helper(id, options \\ []) do
|
||||
|
|
Loading…
Reference in a new issue