pleroma/lib/pleroma/web/activity_pub/mrf/remove_sponsorship.ex
Sam Therapy 33c0a207ba
Shove all changes in one commit
Moderators: reorganize :admin_api pipeline in Router

Add block notify from Soapbox
2022-02-12 11:53:32 -06:00

25 lines
624 B
Elixir

defmodule Pleroma.Web.ActivityPub.MRF.RemoveSponsorship do
@behaviour Pleroma.Web.ActivityPub.MRF.Policy
@impl true
def filter(
%{
"type" => "Create",
"object" => %{"content" => content, "attachment" => _} = _child_object
} = object
) do
nc =
content
|> String.replace(~r/(<p>=&gt;|ufgloves).*/, "")
|> String.replace(~r/<p>--<br \/>Original: <a href="https:\/\/www\.twitter\.com\/.*/, "")
{:ok, put_in(object, ["object", "content"], nc)}
end
@impl true
def filter(object), do: {:ok, object}
@impl true
def describe, do: {:ok, %{}}
end