commit: bb27e4134b67e406810e40bbefd99fe392c25fed
parent 4a32b584e148a5625a983e0932f2a3e16fdbbf30
Author: Lain Soykaf <lain@lain.com>
Date: Thu, 15 Dec 2022 18:06:28 -0500
AudioVideoValidator: Fix embedded attachment requirements
Diffstat:
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/pleroma/web/activity_pub/object_validators/audio_video_validator.ex b/lib/pleroma/web/activity_pub/object_validators/audio_video_validator.ex
@@ -104,14 +104,14 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.AudioVideoValidator 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()
diff --git a/test/pleroma/object/fetcher_test.exs b/test/pleroma/object/fetcher_test.exs
@@ -166,7 +166,7 @@ defmodule Pleroma.Object.FetcherTest 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)