ObjectValidator: Clarify type of object.
This commit is contained in:
parent
adc199c6a8
commit
aee815b478
|
@ -24,13 +24,13 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidator do
|
||||||
@spec validate(map(), keyword()) :: {:ok, map(), keyword()} | {:error, any()}
|
@spec validate(map(), keyword()) :: {:ok, map(), keyword()} | {:error, any()}
|
||||||
def validate(object, meta)
|
def validate(object, meta)
|
||||||
|
|
||||||
def validate(%{"type" => "Update"} = object, meta) do
|
def validate(%{"type" => "Update"} = update_activity, meta) do
|
||||||
with {:ok, object} <-
|
with {:ok, update_activity} <-
|
||||||
object
|
update_activity
|
||||||
|> UpdateValidator.cast_and_validate()
|
|> UpdateValidator.cast_and_validate()
|
||||||
|> Ecto.Changeset.apply_action(:insert) do
|
|> Ecto.Changeset.apply_action(:insert) do
|
||||||
object = stringify_keys(object)
|
update_activity = stringify_keys(update_activity)
|
||||||
{:ok, object, meta}
|
{:ok, update_activity, meta}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue