create_question_validator: remove validate_recipients_match
This commit is contained in:
parent
ad867ccfa1
commit
47ba796f41
1 changed files with 0 additions and 17 deletions
|
@ -47,7 +47,6 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.CreateQuestionValidator do
|
||||||
|> validate_inclusion(:type, ["Create"])
|
|> validate_inclusion(:type, ["Create"])
|
||||||
|> validate_actor_presence()
|
|> validate_actor_presence()
|
||||||
|> validate_any_presence([:to, :cc])
|
|> validate_any_presence([:to, :cc])
|
||||||
|> validate_recipients_match(meta)
|
|
||||||
|> validate_actors_match(meta)
|
|> validate_actors_match(meta)
|
||||||
|> validate_object_nonexistence()
|
|> validate_object_nonexistence()
|
||||||
end
|
end
|
||||||
|
@ -75,20 +74,4 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.CreateQuestionValidator do
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
def validate_recipients_match(cng, meta) do
|
|
||||||
object_recipients = meta[:object_data]["to"] || []
|
|
||||||
|
|
||||||
cng
|
|
||||||
|> validate_change(:to, fn :to, recipients ->
|
|
||||||
activity_set = MapSet.new(recipients)
|
|
||||||
object_set = MapSet.new(object_recipients)
|
|
||||||
|
|
||||||
if MapSet.equal?(activity_set, object_set) do
|
|
||||||
[]
|
|
||||||
else
|
|
||||||
[{:to, "Recipients don't match with object recipients"}]
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue