Rename Notification.send/1 to Notification.stream/1
Also update other places where we use the term "send" instead of "stream". This should make it clearer that we are streaming these over websockets / web push and not sending an activity.
This commit is contained in:
parent
a5424c3681
commit
b1c52c3062
@ -757,8 +757,9 @@ defmodule Pleroma.Notification do
|
|||||||
|> Repo.update_all(set: [seen: true])
|
|> Repo.update_all(set: [seen: true])
|
||||||
end
|
end
|
||||||
|
|
||||||
@spec send(list(Notification.t())) :: :ok
|
@doc "Streams a list of notifications over websockets and web push"
|
||||||
def send(notifications) do
|
@spec stream(list(Notification.t())) :: :ok
|
||||||
|
def stream(notifications) do
|
||||||
Enum.each(notifications, fn notification ->
|
Enum.each(notifications, fn notification ->
|
||||||
Streamer.stream(["user", "user:notification"], notification)
|
Streamer.stream(["user", "user:notification"], notification)
|
||||||
Push.send(notification)
|
Push.send(notification)
|
||||||
|
@ -201,7 +201,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
|
|||||||
|
|
||||||
def notify_and_stream(activity) do
|
def notify_and_stream(activity) do
|
||||||
{:ok, notifications} = Notification.create_notifications(activity)
|
{:ok, notifications} = Notification.create_notifications(activity)
|
||||||
Notification.send(notifications)
|
Notification.stream(notifications)
|
||||||
|
|
||||||
original_activity =
|
original_activity =
|
||||||
case activity do
|
case activity do
|
||||||
|
@ -592,9 +592,9 @@ defmodule Pleroma.Web.ActivityPub.SideEffects do
|
|||||||
with {:ok, _} <- Repo.delete(object), do: :ok
|
with {:ok, _} <- Repo.delete(object), do: :ok
|
||||||
end
|
end
|
||||||
|
|
||||||
defp send_notifications(meta) do
|
defp stream_notifications(meta) do
|
||||||
Keyword.get(meta, :notifications, [])
|
Keyword.get(meta, :notifications, [])
|
||||||
|> Notification.send()
|
|> Notification.stream()
|
||||||
|
|
||||||
meta
|
meta
|
||||||
end
|
end
|
||||||
@ -625,7 +625,7 @@ defmodule Pleroma.Web.ActivityPub.SideEffects do
|
|||||||
@impl true
|
@impl true
|
||||||
def handle_after_transaction(meta) do
|
def handle_after_transaction(meta) do
|
||||||
meta
|
meta
|
||||||
|> send_notifications()
|
|> stream_notifications()
|
||||||
|> send_streamables()
|
|> send_streamables()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user