From cf96c4005743c61d44e17c9d37c6427eaf69c152 Mon Sep 17 00:00:00 2001 From: Ivan Tashkinov Date: Wed, 22 Jan 2020 21:10:17 +0300 Subject: [#1505] Added Mastodon-compatible `replies` collection to Note federated representation. --- test/web/activity_pub/transmogrifier_test.exs | 47 +++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) (limited to 'test') diff --git a/test/web/activity_pub/transmogrifier_test.exs b/test/web/activity_pub/transmogrifier_test.exs index 5da358c43..418b8a1ca 100644 --- a/test/web/activity_pub/transmogrifier_test.exs +++ b/test/web/activity_pub/transmogrifier_test.exs @@ -2027,4 +2027,51 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do } end 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) + end + + test "returns unmodified object if activity doesn't have self-replies" do + data = Poison.decode!(File.read!("test/fixtures/mastodon-post-activity.json")) + assert Transmogrifier.set_replies(data) == data + end + + test "sets `replies` collection with a limited number of self-replies" do + [user, another_user] = insert_list(2, :user) + + {:ok, %{id: id1} = activity} = CommonAPI.post(user, %{"status" => "1"}) + + {:ok, %{id: id2} = self_reply1} = + CommonAPI.post(user, %{"status" => "self-reply 1", "in_reply_to_status_id" => id1}) + + {: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 + {:ok, _} = + CommonAPI.post(user, %{"status" => "self-reply 3", "in_reply_to_status_id" => id1}) + + {:ok, _} = + CommonAPI.post(user, %{ + "status" => "self-reply to self-reply", + "in_reply_to_status_id" => id2 + }) + + {:ok, _} = + CommonAPI.post(another_user, %{ + "status" => "another user's reply", + "in_reply_to_status_id" => id1 + }) + + object = Object.normalize(activity) + replies_uris = Enum.map([self_reply1, self_reply2], fn a -> a.data["id"] end) + + assert %{ + "type" => "Collection", + "first" => %{"type" => "Collection", "items" => ^replies_uris} + } = Transmogrifier.set_replies(object.data)["replies"] + end + end end -- cgit v1.2.3 From 86e4d23acb640efea8cbc879ddbeadfa0e04f9c8 Mon Sep 17 00:00:00 2001 From: Ivan Tashkinov Date: Sat, 25 Jan 2020 10:47:30 +0300 Subject: [#1505] Background fetching of incoming activities' `replies` collections. --- test/support/oban_helpers.ex | 4 +++ test/web/activity_pub/transmogrifier_test.exs | 48 +++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) (limited to 'test') diff --git a/test/support/oban_helpers.ex b/test/support/oban_helpers.ex index 72792c064..0e3b654df 100644 --- a/test/support/oban_helpers.ex +++ b/test/support/oban_helpers.ex @@ -9,6 +9,10 @@ defmodule Pleroma.Tests.ObanHelpers do alias Pleroma.Repo + def wipe_all do + Repo.delete_all(Oban.Job) + end + def perform_all do Oban.Job |> Repo.all() diff --git a/test/web/activity_pub/transmogrifier_test.exs b/test/web/activity_pub/transmogrifier_test.exs index 418b8a1ca..0fefb60da 100644 --- a/test/web/activity_pub/transmogrifier_test.exs +++ b/test/web/activity_pub/transmogrifier_test.exs @@ -3,7 +3,9 @@ # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do + use Oban.Testing, repo: Pleroma.Repo use Pleroma.DataCase + alias Pleroma.Activity alias Pleroma.Object alias Pleroma.Object.Fetcher @@ -1329,6 +1331,52 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do end end + describe "handle_incoming:`replies` handling" do + setup do + data = + File.read!("test/fixtures/mastodon-post-activity.json") + |> Poison.decode!() + + items = ["https://shitposter.club/notice/2827873", "https://shitposter.club/notice/7387606"] + collection = %{"items" => items} + %{data: data, items: items, collection: collection} + end + + test "it schedules background fetching of wrapped `replies` collection items", %{ + data: data, + items: items, + collection: collection + } do + replies = %{"first" => collection} + + object = Map.put(data["object"], "replies", replies) + data = Map.put(data, "object", object) + {:ok, _activity} = Transmogrifier.handle_incoming(data) + + for id <- items do + job_args = %{"op" => "fetch_remote", "id" => id} + assert_enqueued(worker: Pleroma.Workers.RemoteFetcherWorker, args: job_args) + end + end + + test "it schedules background fetching of unwrapped `replies` collection items", %{ + data: data, + items: items, + collection: collection + } do + replies = collection + + object = Map.put(data["object"], "replies", replies) + data = Map.put(data, "object", object) + {:ok, _activity} = Transmogrifier.handle_incoming(data) + + for id <- items do + job_args = %{"op" => "fetch_remote", "id" => id} + assert_enqueued(worker: Pleroma.Workers.RemoteFetcherWorker, args: job_args) + end + end + end + describe "prepare outgoing" do test "it inlines private announced objects" do user = insert(:user) -- cgit v1.2.3 From d458f4fdcafe847a7db8b1c663cfd945019816b7 Mon Sep 17 00:00:00 2001 From: Ivan Tashkinov Date: Sat, 8 Feb 2020 19:58:02 +0300 Subject: [#1505] Added tests, changelog entry, tweaked config settings related to replies output on outgoing federation. --- test/web/activity_pub/transmogrifier_test.exs | 10 +++++----- test/web/activity_pub/views/object_view_test.exs | 22 ++++++++++++++++++++++ 2 files changed, 27 insertions(+), 5 deletions(-) (limited to 'test') diff --git a/test/web/activity_pub/transmogrifier_test.exs b/test/web/activity_pub/transmogrifier_test.exs index 194b314a3..729594ded 100644 --- a/test/web/activity_pub/transmogrifier_test.exs +++ b/test/web/activity_pub/transmogrifier_test.exs @@ -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}) diff --git a/test/web/activity_pub/views/object_view_test.exs b/test/web/activity_pub/views/object_view_test.exs index 13447dc29..6784788cc 100644 --- a/test/web/activity_pub/views/object_view_test.exs +++ b/test/web/activity_pub/views/object_view_test.exs @@ -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) -- cgit v1.2.3 From 7c3991f59eccc47551257dfe41817e71d0eb6717 Mon Sep 17 00:00:00 2001 From: Ivan Tashkinov Date: Sun, 9 Feb 2020 10:17:21 +0300 Subject: [#1505] Fixed `replies` serialization (included objects' ids instead of activities' ids). --- test/web/activity_pub/transmogrifier_test.exs | 2 +- test/web/activity_pub/views/object_view_test.exs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/web/activity_pub/transmogrifier_test.exs b/test/web/activity_pub/transmogrifier_test.exs index 3720dda2a..d373762ea 100644 --- a/test/web/activity_pub/transmogrifier_test.exs +++ b/test/web/activity_pub/transmogrifier_test.exs @@ -2133,7 +2133,7 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do }) object = Object.normalize(activity) - replies_uris = Enum.map([self_reply1, self_reply2], fn a -> a.data["id"] end) + replies_uris = Enum.map([self_reply1, self_reply2], fn a -> a.object.data["id"] end) assert %{ "type" => "Collection", diff --git a/test/web/activity_pub/views/object_view_test.exs b/test/web/activity_pub/views/object_view_test.exs index 6784788cc..a9197b0c5 100644 --- a/test/web/activity_pub/views/object_view_test.exs +++ b/test/web/activity_pub/views/object_view_test.exs @@ -48,8 +48,8 @@ defmodule Pleroma.Web.ActivityPub.ObjectViewTest do {:ok, self_reply1} = CommonAPI.post(user, %{"status" => "self-reply 1", "in_reply_to_status_id" => activity.id}) + replies_uris = [self_reply1.object.data["id"]] result = ObjectView.render("object.json", %{object: refresh_record(activity)}) - replies_uris = [self_reply1.data["id"]] assert %{ "type" => "Collection", -- cgit v1.2.3 From 24e49d14f287b0daf8c2977f2228be09139e4bf3 Mon Sep 17 00:00:00 2001 From: Ivan Tashkinov Date: Sun, 9 Feb 2020 17:34:48 +0300 Subject: [#1505] Removed wrapping of reply URIs into `first` element, added comments to transmogrifier tests. --- test/web/activity_pub/transmogrifier_test.exs | 8 ++++---- test/web/activity_pub/views/object_view_test.exs | 6 ++---- 2 files changed, 6 insertions(+), 8 deletions(-) (limited to 'test') diff --git a/test/web/activity_pub/transmogrifier_test.exs b/test/web/activity_pub/transmogrifier_test.exs index d373762ea..7d9828d38 100644 --- a/test/web/activity_pub/transmogrifier_test.exs +++ b/test/web/activity_pub/transmogrifier_test.exs @@ -1361,6 +1361,7 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do %{data: data, items: items, collection: collection} end + # Mastodon wraps reply URIs in `replies->first->items` test "with wrapped `replies` collection, it schedules background fetching of items", %{ data: data, items: items, @@ -1378,6 +1379,7 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do end end + # Pleroma outputs reply URIs as `replies->items` test "it schedules background fetching of unwrapped `replies` collection items", %{ data: data, items: items, @@ -2135,10 +2137,8 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do object = Object.normalize(activity) replies_uris = Enum.map([self_reply1, self_reply2], fn a -> a.object.data["id"] end) - assert %{ - "type" => "Collection", - "first" => %{"type" => "Collection", "items" => ^replies_uris} - } = Transmogrifier.set_replies(object.data)["replies"] + assert %{"type" => "Collection", "items" => ^replies_uris} = + Transmogrifier.set_replies(object.data)["replies"] end end end diff --git a/test/web/activity_pub/views/object_view_test.exs b/test/web/activity_pub/views/object_view_test.exs index a9197b0c5..acc855b98 100644 --- a/test/web/activity_pub/views/object_view_test.exs +++ b/test/web/activity_pub/views/object_view_test.exs @@ -51,10 +51,8 @@ defmodule Pleroma.Web.ActivityPub.ObjectViewTest do replies_uris = [self_reply1.object.data["id"]] result = ObjectView.render("object.json", %{object: refresh_record(activity)}) - assert %{ - "type" => "Collection", - "first" => %{"type" => "Collection", "items" => ^replies_uris} - } = get_in(result, ["object", "replies"]) + assert %{"type" => "Collection", "items" => ^replies_uris} = + get_in(result, ["object", "replies"]) end end -- cgit v1.2.3 From b95dd5e217e7e1477b53deb9992b65f20b5649ac Mon Sep 17 00:00:00 2001 From: Ivan Tashkinov Date: Mon, 10 Feb 2020 11:46:16 +0300 Subject: [#1505] Improved replies-handling tests: updated Mastodon message fixture, used exact Pleroma federation message. --- test/fixtures/mastodon-post-activity.json | 13 ++++++ test/web/activity_pub/transmogrifier_test.exs | 57 ++++++++++++++------------- 2 files changed, 42 insertions(+), 28 deletions(-) (limited to 'test') diff --git a/test/fixtures/mastodon-post-activity.json b/test/fixtures/mastodon-post-activity.json index b91263431..5c3d22722 100644 --- a/test/fixtures/mastodon-post-activity.json +++ b/test/fixtures/mastodon-post-activity.json @@ -35,6 +35,19 @@ "inReplyTo": null, "inReplyToAtomUri": null, "published": "2018-02-12T14:08:20Z", + "replies": { + "id": "http://mastodon.example.org/users/admin/statuses/99512778738411822/replies", + "type": "Collection", + "first": { + "type": "CollectionPage", + "next": "http://mastodon.example.org/users/admin/statuses/99512778738411822/replies?min_id=99512778738411824&page=true", + "partOf": "http://mastodon.example.org/users/admin/statuses/99512778738411822/replies", + "items": [ + "http://mastodon.example.org/users/admin/statuses/99512778738411823", + "http://mastodon.example.org/users/admin/statuses/99512778738411824" + ] + } + }, "sensitive": true, "summary": "cw", "tag": [ diff --git a/test/web/activity_pub/transmogrifier_test.exs b/test/web/activity_pub/transmogrifier_test.exs index 7d9828d38..bb68809b0 100644 --- a/test/web/activity_pub/transmogrifier_test.exs +++ b/test/web/activity_pub/transmogrifier_test.exs @@ -1350,27 +1350,20 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do end end - describe "`replies` handling in handle_incoming/2" do - setup do + describe "handle_incoming/2: `replies` handling:" do + clear_config([:activitypub, :note_replies_output_limit]) do + Pleroma.Config.put([:activitypub, :note_replies_output_limit], 5) + end + + test "with Mastodon-formatted `replies` collection, it schedules background fetching of items" do data = - File.read!("test/fixtures/mastodon-post-activity.json") + "test/fixtures/mastodon-post-activity.json" + |> File.read!() |> Poison.decode!() - items = ["https://shitposter.club/notice/2827873", "https://shitposter.club/notice/7387606"] - collection = %{"items" => items} - %{data: data, items: items, collection: collection} - end + items = get_in(data, ["object", "replies", "first", "items"]) + assert length(items) > 0 - # Mastodon wraps reply URIs in `replies->first->items` - test "with wrapped `replies` collection, it schedules background fetching of items", %{ - data: data, - items: items, - collection: collection - } do - replies = %{"first" => collection} - - object = Map.put(data["object"], "replies", replies) - data = Map.put(data, "object", object) {:ok, _activity} = Transmogrifier.handle_incoming(data) for id <- items do @@ -1379,19 +1372,27 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do end end - # Pleroma outputs reply URIs as `replies->items` - test "it schedules background fetching of unwrapped `replies` collection items", %{ - data: data, - items: items, - collection: collection - } do - replies = collection + test "with Pleroma-formatted `replies` collection, it schedules background fetching of items" do + user = insert(:user) - object = Map.put(data["object"], "replies", replies) - data = Map.put(data, "object", object) - {:ok, _activity} = Transmogrifier.handle_incoming(data) + {:ok, activity} = CommonAPI.post(user, %{"status" => "post1"}) - for id <- items do + {:ok, reply1} = + CommonAPI.post(user, %{"status" => "reply1", "in_reply_to_status_id" => activity.id}) + + {:ok, reply2} = + CommonAPI.post(user, %{"status" => "reply2", "in_reply_to_status_id" => activity.id}) + + replies_uris = Enum.map([reply1, reply2], fn a -> a.object.data["id"] end) + + {:ok, federation_output} = Transmogrifier.prepare_outgoing(activity.data) + + Repo.delete(activity.object) + Repo.delete(activity) + + {:ok, _activity} = Transmogrifier.handle_incoming(federation_output) + + for id <- replies_uris do job_args = %{"op" => "fetch_remote", "id" => id} assert_enqueued(worker: Pleroma.Workers.RemoteFetcherWorker, args: job_args) end -- cgit v1.2.3 From 269d592181bff8601f6545b85158ee1c222ff20d Mon Sep 17 00:00:00 2001 From: Ivan Tashkinov Date: Sat, 15 Feb 2020 20:41:38 +0300 Subject: [#1505] Restricted max thread distance for fetching replies on incoming federation (in addition to reply-to depth restriction). --- test/object/fetcher_test.exs | 25 +++++++++++ test/web/activity_pub/transmogrifier_test.exs | 62 +++++++++++++++++++++++---- 2 files changed, 79 insertions(+), 8 deletions(-) (limited to 'test') diff --git a/test/object/fetcher_test.exs b/test/object/fetcher_test.exs index 2aad7a588..3afd35648 100644 --- a/test/object/fetcher_test.exs +++ b/test/object/fetcher_test.exs @@ -26,6 +26,31 @@ defmodule Pleroma.Object.FetcherTest do :ok end + describe "max thread distance restriction" do + @ap_id "http://mastodon.example.org/@admin/99541947525187367" + + clear_config([:instance, :federation_incoming_replies_max_depth]) + + test "it returns thread depth exceeded error if thread depth is exceeded" do + Pleroma.Config.put([:instance, :federation_incoming_replies_max_depth], 0) + + assert {:error, "Max thread distance exceeded."} = + Fetcher.fetch_object_from_id(@ap_id, depth: 1) + end + + test "it fetches object if max thread depth is restricted to 0 and depth is not specified" do + Pleroma.Config.put([:instance, :federation_incoming_replies_max_depth], 0) + + assert {:ok, _} = Fetcher.fetch_object_from_id(@ap_id) + end + + test "it fetches object if requested depth does not exceed max thread depth" do + Pleroma.Config.put([:instance, :federation_incoming_replies_max_depth], 10) + + assert {:ok, _} = Fetcher.fetch_object_from_id(@ap_id, depth: 10) + end + end + describe "actor origin containment" do test "it rejects objects with a bogus origin" do {:error, _} = Fetcher.fetch_object_from_id("https://info.pleroma.site/activity.json") diff --git a/test/web/activity_pub/transmogrifier_test.exs b/test/web/activity_pub/transmogrifier_test.exs index bb68809b0..937f78cbe 100644 --- a/test/web/activity_pub/transmogrifier_test.exs +++ b/test/web/activity_pub/transmogrifier_test.exs @@ -42,7 +42,7 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do end @tag capture_log: true - test "it fetches replied-to activities if we don't have them" do + test "it fetches reply-to activities if we don't have them" do data = File.read!("test/fixtures/mastodon-post-activity.json") |> Poison.decode!() @@ -63,7 +63,7 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do assert returned_object.data["inReplyToAtomUri"] == "https://shitposter.club/notice/2827873" end - test "it does not fetch replied-to activities beyond max_replies_depth" do + test "it does not fetch reply-to activities beyond max replies depth limit" do data = File.read!("test/fixtures/mastodon-post-activity.json") |> Poison.decode!() @@ -75,7 +75,7 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do data = Map.put(data, "object", object) with_mock Pleroma.Web.Federator, - allowed_incoming_reply_depth?: fn _ -> false end do + allowed_thread_distance?: fn _ -> false end do {:ok, returned_activity} = Transmogrifier.handle_incoming(data) returned_object = Object.normalize(returned_activity, false) @@ -1350,12 +1350,14 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do end end - describe "handle_incoming/2: `replies` handling:" do + describe "`handle_incoming/2`, Mastodon format `replies` handling" do clear_config([:activitypub, :note_replies_output_limit]) do Pleroma.Config.put([:activitypub, :note_replies_output_limit], 5) end - test "with Mastodon-formatted `replies` collection, it schedules background fetching of items" do + clear_config([:instance, :federation_incoming_replies_max_depth]) + + setup do data = "test/fixtures/mastodon-post-activity.json" |> File.read!() @@ -1364,15 +1366,41 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do items = get_in(data, ["object", "replies", "first", "items"]) assert length(items) > 0 + %{data: data, items: items} + end + + test "schedules background fetching of `replies` items if max thread depth limit allows", %{ + data: data, + items: items + } do + Pleroma.Config.put([:instance, :federation_incoming_replies_max_depth], 10) + {:ok, _activity} = Transmogrifier.handle_incoming(data) for id <- items do - job_args = %{"op" => "fetch_remote", "id" => id} + job_args = %{"op" => "fetch_remote", "id" => id, "depth" => 1} assert_enqueued(worker: Pleroma.Workers.RemoteFetcherWorker, args: job_args) end end - test "with Pleroma-formatted `replies` collection, it schedules background fetching of items" do + test "does NOT schedule background fetching of `replies` beyond max thread depth limit allows", + %{data: data} do + Pleroma.Config.put([:instance, :federation_incoming_replies_max_depth], 0) + + {:ok, _activity} = Transmogrifier.handle_incoming(data) + + assert all_enqueued(worker: Pleroma.Workers.RemoteFetcherWorker) == [] + end + end + + describe "`handle_incoming/2`, Pleroma format `replies` handling" do + clear_config([:activitypub, :note_replies_output_limit]) do + Pleroma.Config.put([:activitypub, :note_replies_output_limit], 5) + end + + clear_config([:instance, :federation_incoming_replies_max_depth]) + + setup do user = insert(:user) {:ok, activity} = CommonAPI.post(user, %{"status" => "post1"}) @@ -1390,13 +1418,31 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do Repo.delete(activity.object) Repo.delete(activity) + %{federation_output: federation_output, replies_uris: replies_uris} + end + + test "schedules background fetching of `replies` items if max thread depth limit allows", %{ + federation_output: federation_output, + replies_uris: replies_uris + } do + Pleroma.Config.put([:instance, :federation_incoming_replies_max_depth], 1) + {:ok, _activity} = Transmogrifier.handle_incoming(federation_output) for id <- replies_uris do - job_args = %{"op" => "fetch_remote", "id" => id} + job_args = %{"op" => "fetch_remote", "id" => id, "depth" => 1} assert_enqueued(worker: Pleroma.Workers.RemoteFetcherWorker, args: job_args) end end + + test "does NOT schedule background fetching of `replies` beyond max thread depth limit allows", + %{federation_output: federation_output} do + Pleroma.Config.put([:instance, :federation_incoming_replies_max_depth], 0) + + {:ok, _activity} = Transmogrifier.handle_incoming(federation_output) + + assert all_enqueued(worker: Pleroma.Workers.RemoteFetcherWorker) == [] + end end describe "prepare outgoing" do -- cgit v1.2.3