Merge branch 'workerhelper-fix' into 'develop'

Fix WebPush notifications not generating jobs

See merge request pleroma/pleroma!4210
This commit is contained in:
feld 2024-08-07 17:37:44 +00:00
commit 45611ed325
3 changed files with 7 additions and 9 deletions

View file

@ -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.

View file

@ -29,5 +29,6 @@ defmodule Pleroma.Web.Push do
{:ok, Oban.Job.t()} | {:error, Oban.Job.changeset() | term()} {:ok, Oban.Job.t()} | {:error, Oban.Job.changeset() | term()}
def send(notification) do def send(notification) do
WebPusherWorker.new(%{"op" => "web_push", "notification_id" => notification.id}) WebPusherWorker.new(%{"op" => "web_push", "notification_id" => notification.id})
|> Oban.insert()
end end
end end

View file

@ -54,20 +54,17 @@ defmodule Pleroma.Web.ActivityPub.SideEffectsTest do
[ [
stream: fn _, _ -> nil end stream: fn _, _ -> nil end
] ]
},
{
Pleroma.Web.Push,
[],
[
send: fn _ -> nil end
]
} }
]) do ]) do
SideEffects.handle_after_transaction(meta) SideEffects.handle_after_transaction(meta)
assert called(Pleroma.Web.Streamer.stream(["user", "user:notification"], notification)) assert called(Pleroma.Web.Streamer.stream(["user", "user:notification"], notification))
assert called(Pleroma.Web.Streamer.stream(["user", "user:pleroma_chat"], :_)) 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 end
end end