don't publish public activities to quarantined
Some checks are pending
ci/woodpecker/push/docs Pipeline is pending
ci/woodpecker/push/release Pipeline is pending
ci/woodpecker/push/test Pipeline is pending

This commit is contained in:
FloatingGhost 2022-07-25 17:30:02 +01:00
parent 516d155558
commit 4e693e674e
2 changed files with 7 additions and 11 deletions

View file

@ -104,18 +104,14 @@ defp signature_host(%URI{port: port, scheme: scheme, host: host}) do
end
defp should_federate?(inbox, public) do
if public do
true
else
%{host: host} = URI.parse(inbox)
%{host: host} = URI.parse(inbox)
quarantined_instances =
Config.get([:instance, :quarantined_instances], [])
|> Pleroma.Web.ActivityPub.MRF.instance_list_from_tuples()
|> Pleroma.Web.ActivityPub.MRF.subdomains_regex()
quarantined_instances =
Config.get([:instance, :quarantined_instances], [])
|> Pleroma.Web.ActivityPub.MRF.instance_list_from_tuples()
|> Pleroma.Web.ActivityPub.MRF.subdomains_regex()
!Pleroma.Web.ActivityPub.MRF.subdomain_match?(quarantined_instances, host)
end
!Pleroma.Web.ActivityPub.MRF.subdomain_match?(quarantined_instances, host)
end
@spec recipients(User.t(), Activity.t()) :: list(User.t()) | []

View file

@ -267,7 +267,7 @@ test "publish to url with with different ports" do
end
describe "publish/2" do
test_with_mock "doesn't publish a non-public activity to quarantined instances.",
test_with_mock "doesn't publish any activity to quarantined instances.",
Pleroma.Web.Federator.Publisher,
[:passthrough],
[] do