mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-11-10 02:05:12 +00:00
CommonValidations: Remove superfluous function
The `is_active` functionality was integrated into the presence checker.
This commit is contained in:
parent
19c108170e
commit
00c4c6a382
|
@ -59,7 +59,7 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.AnswerValidator do
|
|||
|> validate_required([:id, :inReplyTo, :name, :attributedTo, :actor])
|
||||
|> CommonValidations.validate_any_presence([:cc, :to])
|
||||
|> CommonValidations.validate_fields_match([:actor, :attributedTo])
|
||||
|> CommonValidations.validate_actor_is_active()
|
||||
|> CommonValidations.validate_actor_presence()
|
||||
|> CommonValidations.validate_host_match()
|
||||
end
|
||||
end
|
||||
|
|
|
@ -47,19 +47,6 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.CommonValidations do
|
|||
end)
|
||||
end
|
||||
|
||||
def validate_actor_is_active(cng, options \\ []) do
|
||||
field_name = Keyword.get(options, :field_name, :actor)
|
||||
|
||||
cng
|
||||
|> validate_change(field_name, fn field_name, actor ->
|
||||
if %User{deactivated: false} = User.get_cached_by_ap_id(actor) do
|
||||
[]
|
||||
else
|
||||
[{field_name, "can't find user (or deactivated)"}]
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
def validate_object_presence(cng, options \\ []) do
|
||||
field_name = Keyword.get(options, :field_name, :object)
|
||||
allowed_types = Keyword.get(options, :allowed_types, false)
|
||||
|
|
|
@ -55,7 +55,7 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.CreateGenericValidator do
|
|||
cng
|
||||
|> validate_required([:actor, :type, :object])
|
||||
|> validate_inclusion(:type, ["Create"])
|
||||
|> validate_actor_is_active()
|
||||
|> validate_actor_presence()
|
||||
|> validate_any_presence([:to, :cc])
|
||||
|> validate_actors_match(meta)
|
||||
|> validate_context_match(meta)
|
||||
|
|
|
@ -114,7 +114,7 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.QuestionValidator do
|
|||
|> validate_required([:id, :actor, :attributedTo, :type, :context])
|
||||
|> CommonValidations.validate_any_presence([:cc, :to])
|
||||
|> CommonValidations.validate_fields_match([:actor, :attributedTo])
|
||||
|> CommonValidations.validate_actor_is_active()
|
||||
|> CommonValidations.validate_actor_presence()
|
||||
|> CommonValidations.validate_any_presence([:oneOf, :anyOf])
|
||||
|> CommonValidations.validate_host_match()
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue