commit: 45611ed3255035845194d37cf1acd5d35f77a164
parent c81c663db3c02f4c2e2707be2e5f307bd7c80689
Author: feld <feld@feld.me>
Date: Wed, 7 Aug 2024 17:37:44 +0000
Merge branch 'workerhelper-fix' into 'develop'
Fix WebPush notifications not generating jobs
See merge request pleroma/pleroma!4210
Diffstat:
3 files changed, 7 insertions(+), 9 deletions(-)
diff --git a/changelog.d/workerhelper.change b/changelog.d/workerhelper.change
@@ -1 +1 @@
-Worker configuration is no longer available. This only affects custom max_retries values for Oban queues.
+Worker configuration is no longer available. This only affects custom max_retries values for a couple Oban queues.
diff --git a/lib/pleroma/web/push.ex b/lib/pleroma/web/push.ex
@@ -29,5 +29,6 @@ defmodule Pleroma.Web.Push do
{:ok, Oban.Job.t()} | {:error, Oban.Job.changeset() | term()}
def send(notification) do
WebPusherWorker.new(%{"op" => "web_push", "notification_id" => notification.id})
+ |> Oban.insert()
end
end
diff --git a/test/pleroma/web/activity_pub/side_effects_test.exs b/test/pleroma/web/activity_pub/side_effects_test.exs
@@ -54,20 +54,17 @@ defmodule Pleroma.Web.ActivityPub.SideEffectsTest do
[
stream: fn _, _ -> nil end
]
- },
- {
- Pleroma.Web.Push,
- [],
- [
- send: fn _ -> nil end
- ]
}
]) do
SideEffects.handle_after_transaction(meta)
assert called(Pleroma.Web.Streamer.stream(["user", "user:notification"], notification))
assert called(Pleroma.Web.Streamer.stream(["user", "user:pleroma_chat"], :_))
- assert called(Pleroma.Web.Push.send(notification))
+
+ assert_enqueued(
+ worker: "Pleroma.Workers.WebPusherWorker",
+ args: %{"notification_id" => notification.id, "op" => "web_push"}
+ )
end
end
end