Add test to validate shared inboxes are used when multiple recipients from the same instance are recipients
This commit is contained in:
parent
8bc59e9743
commit
dcb2b1413b
@ -40,6 +40,44 @@ defmodule Pleroma.Web.FederatorTest do
|
|||||||
%{activity: activity, relay_mock: relay_mock}
|
%{activity: activity, relay_mock: relay_mock}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "to shared inbox when multiple actors from same instance are recipients" do
|
||||||
|
user = insert(:user)
|
||||||
|
|
||||||
|
shared_inbox = "https://domain.com/inbox"
|
||||||
|
|
||||||
|
follower_one =
|
||||||
|
insert(:user, %{
|
||||||
|
local: false,
|
||||||
|
nickname: "nick1@domain.com",
|
||||||
|
ap_id: "https://domain.com/users/nick1",
|
||||||
|
inbox: "https://domain.com/users/nick1/inbox",
|
||||||
|
shared_inbox: shared_inbox
|
||||||
|
})
|
||||||
|
|
||||||
|
follower_two =
|
||||||
|
insert(:user, %{
|
||||||
|
local: false,
|
||||||
|
nickname: "nick2@domain.com",
|
||||||
|
ap_id: "https://domain.com/users/nick2",
|
||||||
|
inbox: "https://domain.com/users/nick2/inbox",
|
||||||
|
shared_inbox: shared_inbox
|
||||||
|
})
|
||||||
|
|
||||||
|
{:ok, _, _} = Pleroma.User.follow(follower_one, user)
|
||||||
|
{:ok, _, _} = Pleroma.User.follow(follower_two, user)
|
||||||
|
|
||||||
|
{:ok, _activity} = CommonAPI.post(user, %{status: "Happy Friday everyone!"})
|
||||||
|
|
||||||
|
ObanHelpers.perform(all_enqueued(worker: PublisherWorker))
|
||||||
|
|
||||||
|
inboxes =
|
||||||
|
all_enqueued(worker: PublisherWorker)
|
||||||
|
|> Enum.filter(&(get_in(&1, [Access.key(:args), Access.key("op")]) == "publish_one"))
|
||||||
|
|> Enum.map(&get_in(&1, [Access.key(:args), Access.key("params"), Access.key("inbox")]))
|
||||||
|
|
||||||
|
assert [shared_inbox] == inboxes
|
||||||
|
end
|
||||||
|
|
||||||
test "with relays active, it publishes to the relay", %{
|
test "with relays active, it publishes to the relay", %{
|
||||||
activity: activity,
|
activity: activity,
|
||||||
relay_mock: relay_mock
|
relay_mock: relay_mock
|
||||||
|
Loading…
Reference in New Issue
Block a user