mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2024-12-23 08:36:29 +00:00
AudioVideoValidator: Fix embedded attachment requirements
This commit is contained in:
parent
4a32b584e1
commit
bb27e4134b
2 changed files with 3 additions and 3 deletions
|
@ -104,14 +104,14 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.AudioVideoValidator do
|
||||||
|
|
||||||
struct
|
struct
|
||||||
|> cast(data, __schema__(:fields) -- [:attachment, :tag])
|
|> cast(data, __schema__(:fields) -- [:attachment, :tag])
|
||||||
|> cast_embed(:attachment)
|
|> cast_embed(:attachment, required: true)
|
||||||
|> cast_embed(:tag)
|
|> cast_embed(:tag)
|
||||||
end
|
end
|
||||||
|
|
||||||
defp validate_data(data_cng) do
|
defp validate_data(data_cng) do
|
||||||
data_cng
|
data_cng
|
||||||
|> validate_inclusion(:type, ["Audio", "Video"])
|
|> validate_inclusion(:type, ["Audio", "Video"])
|
||||||
|> validate_required([:id, :actor, :attributedTo, :type, :context, :attachment])
|
|> validate_required([:id, :actor, :attributedTo, :type, :context])
|
||||||
|> CommonValidations.validate_any_presence([:cc, :to])
|
|> CommonValidations.validate_any_presence([:cc, :to])
|
||||||
|> CommonValidations.validate_fields_match([:actor, :attributedTo])
|
|> CommonValidations.validate_fields_match([:actor, :attributedTo])
|
||||||
|> CommonValidations.validate_actor_presence()
|
|> CommonValidations.validate_actor_presence()
|
||||||
|
|
|
@ -166,7 +166,7 @@ defmodule Pleroma.Object.FetcherTest do
|
||||||
Instances.set_consistently_unreachable(id)
|
Instances.set_consistently_unreachable(id)
|
||||||
refute Instances.reachable?(id)
|
refute Instances.reachable?(id)
|
||||||
|
|
||||||
{:ok, object} =
|
{:ok, _object} =
|
||||||
Fetcher.fetch_object_from_id("http://mastodon.example.org/@admin/99541947525187367")
|
Fetcher.fetch_object_from_id("http://mastodon.example.org/@admin/99541947525187367")
|
||||||
|
|
||||||
assert Instances.reachable?(id)
|
assert Instances.reachable?(id)
|
||||||
|
|
Loading…
Reference in a new issue