Do not require a cc field when validating an incoming Follow activity

The cc field is not required and the code was keeping the cc if it existed on an activity or replacing it with the default of an empty list when casting. If any Follow activity was received with a cc field, it would attempt to keep it.

This was noticed in !4208 where we would craft Follow requests with a cc value of nil.
This commit is contained in:
Mark Felder 2024-08-07 14:38:29 -04:00
parent d2d07bfe4b
commit 8f15000c0f

View file

@ -29,7 +29,7 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.FollowValidator do
defp validate_data(cng) do
cng
|> validate_required([:id, :type, :actor, :to, :cc, :object])
|> validate_required([:id, :type, :actor, :to, :object])
|> validate_inclusion(:type, ["Follow"])
|> validate_inclusion(:state, ~w{pending reject accept})
|> validate_actor_presence()