Pleroma.Activity.mastodon_notification_type/1
This commit is contained in:
parent
331396cbcd
commit
ec0e613eca
3 changed files with 41 additions and 51 deletions
|
|
@ -54,7 +54,7 @@ defmodule Pleroma.Web.Push do
|
|||
when type in @types do
|
||||
actor = User.get_cached_by_ap_id(notification.activity.data["actor"])
|
||||
|
||||
type = format_type(notification)
|
||||
type = Pleroma.Activity.mastodon_notification_type(notification.activity)
|
||||
|
||||
Subscription
|
||||
|> where(user_id: ^user_id)
|
||||
|
|
@ -114,16 +114,6 @@ defmodule Pleroma.Web.Push do
|
|||
{:noreply, state}
|
||||
end
|
||||
|
||||
# https://github.com/tootsuite/mastodon/blob/master/app/models/notification.rb#L19
|
||||
defp format_type(%{activity: %{data: %{"type" => type}}}) do
|
||||
case type do
|
||||
"Create" -> "mention"
|
||||
"Follow" -> "follow"
|
||||
"Announce" -> "reblog"
|
||||
"Like" -> "favourite"
|
||||
end
|
||||
end
|
||||
|
||||
defp format_title(%{activity: %{data: %{"type" => type}}}) do
|
||||
case type do
|
||||
"Create" -> "New Mention"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue