Change response format of /api/pleroma/emoji to the one that actually makes sense
[akkoma] / lib / pleroma / web / push / impl.ex
index 4d65ca5d546a9803c78b97fde1b3e0b85eefbc32..2233480c5ed9c2903f78ee246e5dbf5280e215d4 100644 (file)
@@ -5,13 +5,13 @@
 defmodule Pleroma.Web.Push.Impl do
   @moduledoc "The module represents implementation push web notification"
 
-  alias Pleroma.Repo
-  alias Pleroma.User
   alias Pleroma.Activity
+  alias Pleroma.Notification
   alias Pleroma.Object
-  alias Pleroma.Web.Push.Subscription
+  alias Pleroma.Repo
+  alias Pleroma.User
   alias Pleroma.Web.Metadata.Utils
-  alias Pleroma.Notification
+  alias Pleroma.Web.Push.Subscription
 
   require Logger
   import Ecto.Query
@@ -19,8 +19,11 @@ defmodule Pleroma.Web.Push.Impl do
   @types ["Create", "Follow", "Announce", "Like"]
 
   @doc "Performs sending notifications for user subscriptions"
-  @spec perform_send(Notification.t()) :: list(any)
-  def perform_send(%{activity: %{data: %{"type" => activity_type}, id: activity_id}, user_id: user_id} = notif)
+  @spec perform(Notification.t()) :: list(any) | :error
+  def perform(
+        %{activity: %{data: %{"type" => activity_type}, id: activity_id}, user_id: user_id} =
+          notif
+      )
       when activity_type in @types do
     actor = User.get_cached_by_ap_id(notif.activity.data["actor"])
 
@@ -47,7 +50,7 @@ defmodule Pleroma.Web.Push.Impl do
     end
   end
 
-  def perform_send(_) do
+  def perform(_) do
     Logger.warn("Unknown notification type")
     :error
   end