diff options
author | lain <lain@soykaf.club> | 2020-11-18 18:33:48 +0000 |
---|---|---|
committer | lain <lain@soykaf.club> | 2020-11-18 18:33:48 +0000 |
commit | aae669d05ec737f7e895ed0d19f7b0eacf6cd005 (patch) | |
tree | 3d1a244162e92a99c1e28f5e2a4829de1eaadeec /lib/pleroma/web/push/impl.ex | |
parent | 6b32e1de234a84d0bdbbee5eeb5b2a543f24ce6b (diff) | |
parent | 1b63aa0b4f969a404cc354ae45852b551fed61b1 (diff) | |
download | pleroma-aae669d05ec737f7e895ed0d19f7b0eacf6cd005.tar.gz |
Merge branch 'fix/webpush-and-emojireact' into 'develop'
Push notifications: add pleroma:emoji_reaction, improve tests
Closes #2185
See merge request pleroma/pleroma!3141
Diffstat (limited to 'lib/pleroma/web/push/impl.ex')
-rw-r--r-- | lib/pleroma/web/push/impl.ex | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/pleroma/web/push/impl.ex b/lib/pleroma/web/push/impl.ex index da535aa68..82152dffa 100644 --- a/lib/pleroma/web/push/impl.ex +++ b/lib/pleroma/web/push/impl.ex @@ -16,7 +16,7 @@ defmodule Pleroma.Web.Push.Impl do require Logger import Ecto.Query - @types ["Create", "Follow", "Announce", "Like", "Move"] + @types ["Create", "Follow", "Announce", "Like", "Move", "EmojiReact"] @doc "Performs sending notifications for user subscriptions" @spec perform(Notification.t()) :: list(any) | :error | {:error, :unknown_type} @@ -150,6 +150,15 @@ defmodule Pleroma.Web.Push.Impl do end def format_body( + %{activity: %{data: %{"type" => "EmojiReact", "content" => content}}}, + actor, + _object, + _mastodon_type + ) do + "@#{actor.nickname} reacted with #{content}" + end + + def format_body( %{activity: %{data: %{"type" => type}}} = notification, actor, _object, @@ -179,6 +188,7 @@ defmodule Pleroma.Web.Push.Impl do "reblog" -> "New Repeat" "favourite" -> "New Favorite" "pleroma:chat_mention" -> "New Chat Message" + "pleroma:emoji_reaction" -> "New Reaction" type -> "New #{String.capitalize(type || "event")}" end end |