summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Felder <feld@feld.me>2024-08-07 13:00:31 -0400
committerMark Felder <feld@feld.me>2024-08-07 13:00:31 -0400
commit721005b3126e0920ab861fcc83195f160b0ee9a0 (patch)
tree0fbd18943d28f4624ec97a2248a5697c771ab275
parent351a306d462ae804ee9d0bbc9f8e7781caf34533 (diff)
downloadpleroma-721005b3126e0920ab861fcc83195f160b0ee9a0.tar.gz
pleroma-721005b3126e0920ab861fcc83195f160b0ee9a0.zip
Fix WebPush notifications not generating jobs
Dialyzer pointed this one out. The WorkerHelper removal in !4166 was missing this Oban.insert() and tests were not noticing any problems because we mocked the Push.send function instead of executing it and checking for the Oban job.
-rw-r--r--lib/pleroma/web/push.ex1
-rw-r--r--test/pleroma/web/activity_pub/side_effects_test.exs13
2 files changed, 6 insertions, 8 deletions
diff --git a/lib/pleroma/web/push.ex b/lib/pleroma/web/push.ex
index d783f776a..6d777142e 100644
--- 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
index 68922e536..4a18cab68 100644
--- 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