Push.Impl: support edits
[akkoma] / lib / pleroma / web / push / impl.ex
index c30a39e94cf75d7537a816e8cb6a729795b29e29..e103cafc272d473723f142ff2293abe1c3cacc46 100644 (file)
@@ -16,7 +16,7 @@ defmodule Pleroma.Web.Push.Impl do
   require Logger
   import Ecto.Query
 
-  @types ["Create", "Follow", "Announce", "Like", "Move", "EmojiReact"]
+  @types ["Create", "Follow", "Announce", "Like", "Move", "EmojiReact", "Update"]
 
   @doc "Performs sending notifications for user subscriptions"
   @spec perform(Notification.t()) :: list(any) | :error | {:error, :unknown_type}
@@ -167,6 +167,15 @@ defmodule Pleroma.Web.Push.Impl do
     end
   end
 
+  def format_body(
+        %{activity: %{data: %{"type" => "Update"}}},
+        actor,
+        _object,
+        _mastodon_type
+      ) do
+    "@#{actor.nickname} edited a status"
+  end
+
   def format_title(activity, mastodon_type \\ nil)
 
   def format_title(%{activity: %{data: %{"directMessage" => true}}}, _mastodon_type) do
@@ -180,6 +189,7 @@ defmodule Pleroma.Web.Push.Impl do
       "follow_request" -> "New Follow Request"
       "reblog" -> "New Repeat"
       "favourite" -> "New Favorite"
+      "update" -> "New Update"
       "pleroma:emoji_reaction" -> "New Reaction"
       type -> "New #{String.capitalize(type || "event")}"
     end