logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://hacktivis.me/git/pleroma.git
commit: 0ea63d824e6381723ad99e544fd8b08ea9d721fd
parent 3754713599e474754f3d4c07221a88352be8c018
Author: feld <feld@feld.me>
Date:   Fri, 12 Jul 2024 15:58:59 +0000

Merge branch 'oban/deprecate-discards' into 'develop'

Oban: change :discard return values to :cancel

See merge request pleroma/pleroma!4175

Diffstat:

Achangelog.d/oban-deprecated-discards.skip0
Mlib/pleroma/web/activity_pub/publisher.ex6+++---
Mlib/pleroma/workers/remote_fetcher_worker.ex8++++----
Mtest/pleroma/web/activity_pub/publisher_test.exs2+-
Mtest/pleroma/workers/remote_fetcher_worker_test.exs8++++----
5 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/changelog.d/oban-deprecated-discards.skip b/changelog.d/oban-deprecated-discards.skip diff --git a/lib/pleroma/web/activity_pub/publisher.ex b/lib/pleroma/web/activity_pub/publisher.ex @@ -123,9 +123,9 @@ defmodule Pleroma.Web.ActivityPub.Publisher do Logger.error("Publisher failed to inbox #{inbox} with status #{code}") case response do - %{status: 403} -> {:discard, :forbidden} - %{status: 404} -> {:discard, :not_found} - %{status: 410} -> {:discard, :not_found} + %{status: 403} -> {:cancel, :forbidden} + %{status: 404} -> {:cancel, :not_found} + %{status: 410} -> {:cancel, :not_found} _ -> {:error, e} end diff --git a/lib/pleroma/workers/remote_fetcher_worker.ex b/lib/pleroma/workers/remote_fetcher_worker.ex @@ -14,16 +14,16 @@ defmodule Pleroma.Workers.RemoteFetcherWorker do :ok {:rejected, reason} -> - {:discard, reason} + {:cancel, reason} {:error, :forbidden} -> - {:discard, :forbidden} + {:cancel, :forbidden} {:error, :not_found} -> - {:discard, :not_found} + {:cancel, :not_found} {:error, :allowed_depth} -> - {:discard, :allowed_depth} + {:cancel, :allowed_depth} {:error, _} = e -> e diff --git a/test/pleroma/web/activity_pub/publisher_test.exs b/test/pleroma/web/activity_pub/publisher_test.exs @@ -223,7 +223,7 @@ defmodule Pleroma.Web.ActivityPub.PublisherTest do actor = insert(:user) inbox = "http://404.site/users/nick1/inbox" - assert {:discard, _} = + assert {:cancel, _} = Publisher.publish_one(%{inbox: inbox, json: "{}", actor: actor, id: 1}) assert called(Instances.set_unreachable(inbox)) diff --git a/test/pleroma/workers/remote_fetcher_worker_test.exs b/test/pleroma/workers/remote_fetcher_worker_test.exs @@ -39,19 +39,19 @@ defmodule Pleroma.Workers.RemoteFetcherWorkerTest do end test "does not requeue a deleted object" do - assert {:discard, _} = + assert {:cancel, _} = RemoteFetcherWorker.perform(%Oban.Job{ args: %{"op" => "fetch_remote", "id" => @deleted_object_one} }) - assert {:discard, _} = + assert {:cancel, _} = RemoteFetcherWorker.perform(%Oban.Job{ args: %{"op" => "fetch_remote", "id" => @deleted_object_two} }) end test "does not requeue an unauthorized object" do - assert {:discard, _} = + assert {:cancel, _} = RemoteFetcherWorker.perform(%Oban.Job{ args: %{"op" => "fetch_remote", "id" => @unauthorized_object} }) @@ -60,7 +60,7 @@ defmodule Pleroma.Workers.RemoteFetcherWorkerTest do test "does not requeue an object that exceeded depth" do clear_config([:instance, :federation_incoming_replies_max_depth], 0) - assert {:discard, _} = + assert {:cancel, _} = RemoteFetcherWorker.perform(%Oban.Job{ args: %{"op" => "fetch_remote", "id" => @depth_object, "depth" => 1} })