remove public post quarantine exception #114
2 changed files with 18 additions and 4 deletions
|
@ -103,7 +103,7 @@ defp signature_host(%URI{port: port, scheme: scheme, host: host}) do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
defp should_federate?(inbox, public) do
|
defp should_federate?(inbox) do
|
||||||
%{host: host} = URI.parse(inbox)
|
%{host: host} = URI.parse(inbox)
|
||||||
|
|
||||||
quarantined_instances =
|
quarantined_instances =
|
||||||
|
@ -188,7 +188,6 @@ def determine_inbox(
|
||||||
|
|
||||||
def publish(%User{} = actor, %{data: %{"bcc" => bcc}} = activity)
|
def publish(%User{} = actor, %{data: %{"bcc" => bcc}} = activity)
|
||||||
when is_list(bcc) and bcc != [] do
|
when is_list(bcc) and bcc != [] do
|
||||||
public = is_public?(activity)
|
|
||||||
{:ok, data} = Transmogrifier.prepare_outgoing(activity.data)
|
{:ok, data} = Transmogrifier.prepare_outgoing(activity.data)
|
||||||
|
|
||||||
recipients = recipients(actor, activity)
|
recipients = recipients(actor, activity)
|
||||||
|
@ -197,7 +196,7 @@ def publish(%User{} = actor, %{data: %{"bcc" => bcc}} = activity)
|
||||||
recipients
|
recipients
|
||||||
|> Enum.filter(&User.ap_enabled?/1)
|
|> Enum.filter(&User.ap_enabled?/1)
|
||||||
|> Enum.map(fn actor -> actor.inbox end)
|
|> Enum.map(fn actor -> actor.inbox end)
|
||||||
|> Enum.filter(fn inbox -> should_federate?(inbox, public) end)
|
|> Enum.filter(fn inbox -> should_federate?(inbox) end)
|
||||||
|> Instances.filter_reachable()
|
|> Instances.filter_reachable()
|
||||||
|
|
||||||
Repo.checkout(fn ->
|
Repo.checkout(fn ->
|
||||||
|
@ -242,7 +241,7 @@ def publish(%User{} = actor, %Activity{} = activity) do
|
||||||
determine_inbox(activity, user)
|
determine_inbox(activity, user)
|
||||||
end)
|
end)
|
||||||
|> Enum.uniq()
|
|> Enum.uniq()
|
||||||
|> Enum.filter(fn inbox -> should_federate?(inbox, public) end)
|
|> Enum.filter(fn inbox -> should_federate?(inbox) end)
|
||||||
|> Instances.filter_reachable()
|
|> Instances.filter_reachable()
|
||||||
|> Enum.each(fn {inbox, unreachable_since} ->
|
|> Enum.each(fn {inbox, unreachable_since} ->
|
||||||
Pleroma.Web.Federator.Publisher.enqueue_one(
|
Pleroma.Web.Federator.Publisher.enqueue_one(
|
||||||
|
|
|
@ -290,11 +290,18 @@ test "publish to url with with different ports" do
|
||||||
user: actor,
|
user: actor,
|
||||||
recipients: [follower.ap_id]
|
recipients: [follower.ap_id]
|
||||||
)
|
)
|
||||||
|
public_note_activity =
|
||||||
|
insert(:note_activity,
|
||||||
|
user: actor,
|
||||||
|
recipients: [follower.ap_id, @as_public]
|
||||||
|
)
|
||||||
|
|
||||||
res = Publisher.publish(actor, note_activity)
|
res = Publisher.publish(actor, note_activity)
|
||||||
|
|
||||||
assert res == :ok
|
assert res == :ok
|
||||||
|
|
||||||
|
:ok = Publisher.publish(actor, public_note_activity)
|
||||||
|
|
||||||
assert not called(
|
assert not called(
|
||||||
Pleroma.Web.Federator.Publisher.enqueue_one(Publisher, %{
|
Pleroma.Web.Federator.Publisher.enqueue_one(Publisher, %{
|
||||||
inbox: "https://domain.com/users/nick1/inbox",
|
inbox: "https://domain.com/users/nick1/inbox",
|
||||||
|
@ -302,6 +309,13 @@ test "publish to url with with different ports" do
|
||||||
id: note_activity.data["id"]
|
id: note_activity.data["id"]
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
assert not called(
|
||||||
|
Pleroma.Web.Federator.Publisher.enqueue_one(Publisher, %{
|
||||||
|
inbox: "https://domain.com/users/nick1/inbox",
|
||||||
|
actor_id: actor.id,
|
||||||
|
id: public_note_activity.data["id"]
|
||||||
|
})
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
test_with_mock "Publishes a non-public activity to non-quarantined instances.",
|
test_with_mock "Publishes a non-public activity to non-quarantined instances.",
|
||||||
|
@ -345,6 +359,7 @@ test "publish to url with with different ports" do
|
||||||
Pleroma.Web.Federator.Publisher,
|
Pleroma.Web.Federator.Publisher,
|
||||||
[:passthrough],
|
[:passthrough],
|
||||||
[] do
|
[] do
|
||||||
|
Config.put([:instance, :quarantined_instances], [])
|
||||||
follower =
|
follower =
|
||||||
insert(:user, %{
|
insert(:user, %{
|
||||||
local: false,
|
local: false,
|
||||||
|
|
Loading…
Reference in a new issue