AudioVideoValidator: Fix embedded attachment requirements

This commit is contained in:
Lain Soykaf 2022-12-15 18:06:28 -05:00
parent 4a32b584e1
commit bb27e4134b
2 changed files with 3 additions and 3 deletions

View File

@ -104,14 +104,14 @@ def changeset(struct, data) do
struct
|> cast(data, __schema__(:fields) -- [:attachment, :tag])
|> cast_embed(:attachment)
|> cast_embed(:attachment, required: true)
|> cast_embed(:tag)
end
defp validate_data(data_cng) do
data_cng
|> 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_fields_match([:actor, :attributedTo])
|> CommonValidations.validate_actor_presence()

View File

@ -166,7 +166,7 @@ test "it resets instance reachability on successful fetch" do
Instances.set_consistently_unreachable(id)
refute Instances.reachable?(id)
{:ok, object} =
{:ok, _object} =
Fetcher.fetch_object_from_id("http://mastodon.example.org/@admin/99541947525187367")
assert Instances.reachable?(id)