Mark fake activities, revert some error return types for safety
Some checks are pending
ci/woodpecker/pr/build-amd64 Pipeline is pending
ci/woodpecker/pr/build-arm64 Pipeline is pending
ci/woodpecker/pr/docs Pipeline is pending
ci/woodpecker/pr/lint Pipeline is pending
ci/woodpecker/pr/test Pipeline is pending

This commit is contained in:
TudbuT 2024-10-29 18:00:24 +01:00
parent 260cb25025
commit 6718ed74c2
No known key found for this signature in database
GPG key ID: B3CF345217F202D3
3 changed files with 5 additions and 4 deletions

View file

@ -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}

View file

@ -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"])

View file

@ -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