move to 2.5.5
[anni] / static / modules / no_incoming_deletes.ex
1 # THE "CLOUD" IS JUST SOMEONE ELSE'S COMPUTER
2 # have we been using the same internet?
3 defmodule Pleroma.Web.ActivityPub.MRF.NoIncomingDeletes do
4         require Logger
5         @behaviour Pleroma.Web.ActivityPub.MRF.Policy
6
7         @impl true
8         def filter(%{"type" => "Delete", "actor" => actor} = object) do
9                 actor_info = URI.parse(actor)
10                 if(actor_info.host == "annihilation.social") do
11                         Logger.warn("DELETE from ANNI, not rejecting:  #{inspect(object)}")
12                         {:ok, object}
13                 else
14                         Logger.warn("DELETE rejected: #{inspect(object)}")
15                         {:reject, object}
16                 end
17         end
18
19         @impl true
20         def filter(object), do: {:ok, object}
21
22         @impl true
23         def describe, do: {:ok, %{}}
24 end