Pleroma.Activity.mastodon_notification_type/1

This commit is contained in:
href 2018-12-10 15:50:10 +01:00
commit ec0e613eca
No known key found for this signature in database
GPG key ID: EE8296C1A152C325
3 changed files with 41 additions and 51 deletions

View file

@ -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"