forked from AkkomaGang/akkoma
Transmogrifier: Fix BAD code by RINPATCH
This commit is contained in:
parent
1b323ce1c6
commit
c982093cc2
1 changed files with 10 additions and 4 deletions
|
@ -1267,19 +1267,25 @@ defp maybe_add_context_from_object(_) do
|
|||
{:error, :no_context}
|
||||
end
|
||||
|
||||
defp maybe_add_recipients_from_object(%{"to" => [_ | _], "cc" => [_ | _]} = data), do: {:ok, data}
|
||||
defp maybe_add_recipients_from_object(%{"to" => [_ | _], "cc" => [_ | _]} = data),
|
||||
do: {:ok, data}
|
||||
|
||||
defp maybe_add_recipients_from_object(%{"object" => object} = data) do
|
||||
case Object.normalize(object) do
|
||||
%{data: {"actor" => actor}} ->
|
||||
%{data: %{"actor" => actor}} ->
|
||||
data =
|
||||
data
|
||||
|> Map.put("to", [actor])
|
||||
|> Map.put("cc", data["cc"] || [])
|
||||
|
||||
{:ok, data}
|
||||
nil -> {:error, :no_object}
|
||||
_ -> {:error, :no_actor}
|
||||
|
||||
nil ->
|
||||
{:error, :no_object}
|
||||
|
||||
_ ->
|
||||
{:error, :no_actor}
|
||||
end
|
||||
end
|
||||
|
||||
defp maybe_add_recipients_from_object(_) do
|
||||
|
|
Loading…
Reference in a new issue