DeleteValidator: Mastodon sends unaddressed deletes.
This commit is contained in:
parent
bd219ba7e8
commit
db184a8eb4
|
@ -32,7 +32,6 @@ def validate_data(cng) do
|
||||||
|> validate_inclusion(:type, ["Delete"])
|
|> validate_inclusion(:type, ["Delete"])
|
||||||
|> validate_same_domain()
|
|> validate_same_domain()
|
||||||
|> validate_object_presence()
|
|> validate_object_presence()
|
||||||
|> validate_recipients_presence()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def validate_same_domain(cng) do
|
def validate_same_domain(cng) do
|
||||||
|
|
|
@ -59,20 +59,6 @@ test "it's invalid if the actor of the object and the actor of delete are from d
|
||||||
|
|
||||||
assert {:actor, {"is not allowed to delete object", []}} in cng.errors
|
assert {:actor, {"is not allowed to delete object", []}} in cng.errors
|
||||||
end
|
end
|
||||||
|
|
||||||
test "it's invalid if all the recipient fields are empty", %{
|
|
||||||
valid_post_delete: valid_post_delete
|
|
||||||
} do
|
|
||||||
empty_recipients =
|
|
||||||
valid_post_delete
|
|
||||||
|> Map.put("to", [])
|
|
||||||
|> Map.put("cc", [])
|
|
||||||
|
|
||||||
{:error, cng} = ObjectValidator.validate(empty_recipients, [])
|
|
||||||
|
|
||||||
assert {:to, {"no recipients in any field", []}} in cng.errors
|
|
||||||
assert {:cc, {"no recipients in any field", []}} in cng.errors
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "likes" do
|
describe "likes" do
|
||||||
|
|
Loading…
Reference in New Issue