Always accept deletions through SimplePolicy
This commit is contained in:
parent
7ee35eb9a6
commit
9a3c74b244
|
@ -148,6 +148,9 @@ defp check_banner_removal(%{host: actor_host} = _actor_info, %{"image" => _image
|
||||||
|
|
||||||
defp check_banner_removal(_actor_info, object), do: {:ok, object}
|
defp check_banner_removal(_actor_info, object), do: {:ok, object}
|
||||||
|
|
||||||
|
@impl true
|
||||||
|
def filter(%{"type" => "Delete"} = object), do: {:ok, object}
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
def filter(%{"actor" => actor} = object) do
|
def filter(%{"actor" => actor} = object) do
|
||||||
actor_info = URI.parse(actor)
|
actor_info = URI.parse(actor)
|
||||||
|
|
|
@ -258,6 +258,14 @@ test "actor has a matching host" do
|
||||||
|
|
||||||
assert SimplePolicy.filter(remote_user) == {:reject, nil}
|
assert SimplePolicy.filter(remote_user) == {:reject, nil}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "always accept deletions" do
|
||||||
|
Config.put([:mrf_simple, :reject], ["remote.instance"])
|
||||||
|
|
||||||
|
deletion_message = build_remote_deletion_message()
|
||||||
|
|
||||||
|
assert SimplePolicy.filter(deletion_message) == {:ok, deletion_message}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "when :accept" do
|
describe "when :accept" do
|
||||||
|
@ -308,6 +316,14 @@ test "actor has a matching host" do
|
||||||
|
|
||||||
assert SimplePolicy.filter(remote_user) == {:ok, remote_user}
|
assert SimplePolicy.filter(remote_user) == {:ok, remote_user}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "always accept deletions" do
|
||||||
|
Config.put([:mrf_simple, :accept], ["non.matching.remote"])
|
||||||
|
|
||||||
|
deletion_message = build_remote_deletion_message()
|
||||||
|
|
||||||
|
assert SimplePolicy.filter(deletion_message) == {:ok, deletion_message}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "when :avatar_removal" do
|
describe "when :avatar_removal" do
|
||||||
|
@ -408,4 +424,11 @@ defp build_remote_user do
|
||||||
"type" => "Person"
|
"type" => "Person"
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
defp build_remote_deletion_message do
|
||||||
|
%{
|
||||||
|
"type" => "Delete",
|
||||||
|
"actor" => "https://remote.instance/users/bob"
|
||||||
|
}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue