[#1505] Added tests, changelog entry, tweaked config settings related to replies output on outgoing federation.
This commit is contained in:
parent
e84fee5b86
commit
d458f4fdca
7 changed files with 45 additions and 26 deletions
|
|
@ -1350,7 +1350,7 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
|
|||
end
|
||||
end
|
||||
|
||||
describe "handle_incoming:`replies` handling" do
|
||||
describe "`replies` handling in handle_incoming/2" do
|
||||
setup do
|
||||
data =
|
||||
File.read!("test/fixtures/mastodon-post-activity.json")
|
||||
|
|
@ -1361,7 +1361,7 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
|
|||
%{data: data, items: items, collection: collection}
|
||||
end
|
||||
|
||||
test "it schedules background fetching of wrapped `replies` collection items", %{
|
||||
test "with wrapped `replies` collection, it schedules background fetching of items", %{
|
||||
data: data,
|
||||
items: items,
|
||||
collection: collection
|
||||
|
|
@ -2096,8 +2096,8 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
|
|||
end
|
||||
|
||||
describe "set_replies/1" do
|
||||
clear_config([:mastodon_compatibility, :federated_note_replies_limit]) do
|
||||
Pleroma.Config.put([:mastodon_compatibility, :federated_note_replies_limit], 2)
|
||||
clear_config([:activitypub, :note_replies_output_limit]) do
|
||||
Pleroma.Config.put([:activitypub, :note_replies_output_limit], 2)
|
||||
end
|
||||
|
||||
test "returns unmodified object if activity doesn't have self-replies" do
|
||||
|
|
@ -2116,7 +2116,7 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
|
|||
{:ok, self_reply2} =
|
||||
CommonAPI.post(user, %{"status" => "self-reply 2", "in_reply_to_status_id" => id1})
|
||||
|
||||
# Assuming to _not_ be present in `replies` due to :federated_note_replies_limit is set to 2
|
||||
# Assuming to _not_ be present in `replies` due to :note_replies_output_limit is set to 2
|
||||
{:ok, _} =
|
||||
CommonAPI.post(user, %{"status" => "self-reply 3", "in_reply_to_status_id" => id1})
|
||||
|
||||
|
|
|
|||
|
|
@ -36,6 +36,28 @@ defmodule Pleroma.Web.ActivityPub.ObjectViewTest do
|
|||
assert result["@context"]
|
||||
end
|
||||
|
||||
describe "note activity's `replies` collection rendering" do
|
||||
clear_config([:activitypub, :note_replies_output_limit]) do
|
||||
Pleroma.Config.put([:activitypub, :note_replies_output_limit], 5)
|
||||
end
|
||||
|
||||
test "renders `replies` collection for a note activity" do
|
||||
user = insert(:user)
|
||||
activity = insert(:note_activity, user: user)
|
||||
|
||||
{:ok, self_reply1} =
|
||||
CommonAPI.post(user, %{"status" => "self-reply 1", "in_reply_to_status_id" => activity.id})
|
||||
|
||||
result = ObjectView.render("object.json", %{object: refresh_record(activity)})
|
||||
replies_uris = [self_reply1.data["id"]]
|
||||
|
||||
assert %{
|
||||
"type" => "Collection",
|
||||
"first" => %{"type" => "Collection", "items" => ^replies_uris}
|
||||
} = get_in(result, ["object", "replies"])
|
||||
end
|
||||
end
|
||||
|
||||
test "renders a like activity" do
|
||||
note = insert(:note_activity)
|
||||
object = Object.normalize(note)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue