oauth: support either name or username parameter with grant_type=password
[akkoma] / lib / pleroma / web / streamer.ex
index 6aac472dcdefbc6486d0d0151a477b1eb1b146b7..0c9e954854a6ca49f581a69ffa8a59b13a29ac75 100644 (file)
@@ -59,6 +59,19 @@ defmodule Pleroma.Web.Streamer do
     {:noreply, topics}
   end
 
+  def handle_cast(%{action: :stream, topic: "list", item: item}, topics) do
+    recipient_topics =
+      Pleroma.List.get_lists_from_activity(item)
+      |> Enum.map(fn %{id: id} -> "list:#{id}" end)
+
+    Enum.each(recipient_topics || [], fn list_topic ->
+      Logger.debug("Trying to push message to #{list_topic}\n\n")
+      push_to_socket(topics, list_topic, item)
+    end)
+
+    {:noreply, topics}
+  end
+
   def handle_cast(%{action: :stream, topic: "user", item: %Notification{} = item}, topics) do
     topic = "user:#{item.user_id}"
 
@@ -150,7 +163,7 @@ defmodule Pleroma.Web.Streamer do
     end)
   end
 
-  defp internal_topic(topic, socket) when topic in ~w[user, direct] do
+  defp internal_topic(topic, socket) when topic in ~w[user direct] do
     "#{topic}:#{socket.assigns[:user].id}"
   end