defp check_banner_removal(_actor_info, object), do: {:ok, object}
+ @impl true
+ def filter(%{"type" => "Delete"} = object), do: {:ok, object}
+
@impl true
def filter(%{"actor" => actor} = object) do
actor_info = URI.parse(actor)
assert SimplePolicy.filter(remote_user) == {:reject, nil}
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
describe "when :accept" do
assert SimplePolicy.filter(remote_user) == {:ok, remote_user}
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
describe "when :avatar_removal" do
"type" => "Person"
}
end
+
+ defp build_remote_deletion_message do
+ %{
+ "type" => "Delete",
+ "actor" => "https://remote.instance/users/bob"
+ }
+ end
end