1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Web.ActivityPub.ObjectValidators.BlockValidator do
8 alias Elixir.Pleroma.Web.ActivityPub.ObjectValidators.CommonValidations
18 import Elixir.Pleroma.Web.ActivityPub.ObjectValidators.CommonFields
25 def cast_data(data) do
27 |> cast(data, __schema__(:fields))
30 defp validate_data(cng) do
32 |> validate_required([:id, :type, :actor, :to, :cc, :object])
33 |> validate_inclusion(:type, ["Block"])
34 |> CommonValidations.validate_actor_presence()
35 |> CommonValidations.validate_actor_presence(field_name: :object)
38 def cast_and_validate(data) do