Merge pull request 'Federation: always prefer the shared inbox' (#8029) from lambadalambda/pleroma:perf/shared-inbox into develop
Reviewed-on: https://git.pleroma.social/pleroma/pleroma/pulls/8029
This commit is contained in:
commit
dca6c07631
3 changed files with 52 additions and 29 deletions
|
|
@ -137,7 +137,7 @@ defmodule Pleroma.Web.ActivityPub.PublisherTest do
|
|||
assert Publisher.determine_inbox(activity, user) == "http://example.com/inbox"
|
||||
end
|
||||
|
||||
test "it returns inbox for messages involving single recipients in total" do
|
||||
test "it returns sharedInbox for messages to a single recipient" do
|
||||
user =
|
||||
insert(:user, %{
|
||||
shared_inbox: "http://example.com/inbox",
|
||||
|
|
@ -148,6 +148,46 @@ defmodule Pleroma.Web.ActivityPub.PublisherTest do
|
|||
data: %{"to" => [user.ap_id], "cc" => []}
|
||||
}
|
||||
|
||||
assert Publisher.determine_inbox(activity, user) == "http://example.com/inbox"
|
||||
end
|
||||
|
||||
test "it returns sharedInbox for followers-only messages" do
|
||||
user =
|
||||
insert(:user, %{
|
||||
shared_inbox: "http://example.com/inbox",
|
||||
inbox: "http://example.com/personal-inbox"
|
||||
})
|
||||
|
||||
author = insert(:user)
|
||||
|
||||
activity = %Activity{
|
||||
data: %{"to" => [author.follower_address], "cc" => []}
|
||||
}
|
||||
|
||||
assert Publisher.determine_inbox(activity, user) == "http://example.com/inbox"
|
||||
end
|
||||
|
||||
test "it returns inbox for messages with bcc or bto, which needs personal inboxes" do
|
||||
user =
|
||||
insert(:user, %{
|
||||
shared_inbox: "http://example.com/inbox",
|
||||
inbox: "http://example.com/personal-inbox"
|
||||
})
|
||||
|
||||
for field <- ["bcc", "bto"] do
|
||||
activity = %Activity{
|
||||
data: %{"to" => [@as_public], "cc" => [], field => [user.ap_id]}
|
||||
}
|
||||
|
||||
assert Publisher.determine_inbox(activity, user) == "http://example.com/personal-inbox"
|
||||
end
|
||||
end
|
||||
|
||||
test "it returns inbox when the user has no sharedInbox" do
|
||||
user = insert(:user, %{shared_inbox: nil, inbox: "http://example.com/personal-inbox"})
|
||||
|
||||
activity = %Activity{data: %{"to" => [@as_public], "cc" => []}}
|
||||
|
||||
assert Publisher.determine_inbox(activity, user) == "http://example.com/personal-inbox"
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue