diff options
author | lain <lain@soykaf.club> | 2020-06-02 14:22:16 +0200 |
---|---|---|
committer | lain <lain@soykaf.club> | 2020-06-02 14:22:16 +0200 |
commit | 37542a9dfa99cc4324f211b45254acea758ac1ae (patch) | |
tree | 7cfbc63f0179b1cd028c14618fce425c619a565f /lib/pleroma/web/push | |
parent | 127ccc4e1c76c2782b26a0cfbb154bc1317f31b3 (diff) | |
download | pleroma-37542a9dfa99cc4324f211b45254acea758ac1ae.tar.gz |
Activity: Remove notifications-related functions.
Diffstat (limited to 'lib/pleroma/web/push')
-rw-r--r-- | lib/pleroma/web/push/impl.ex | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/lib/pleroma/web/push/impl.ex b/lib/pleroma/web/push/impl.ex index 691725702..125f33755 100644 --- a/lib/pleroma/web/push/impl.ex +++ b/lib/pleroma/web/push/impl.ex @@ -16,8 +16,6 @@ defmodule Pleroma.Web.Push.Impl do require Logger import Ecto.Query - defdelegate mastodon_notification_type(activity), to: Activity - @types ["Create", "Follow", "Announce", "Like", "Move"] @doc "Performs sending notifications for user subscriptions" @@ -31,7 +29,7 @@ defmodule Pleroma.Web.Push.Impl do when activity_type in @types do actor = User.get_cached_by_ap_id(notification.activity.data["actor"]) - mastodon_type = mastodon_notification_type(notification.activity) + mastodon_type = notification.type gcm_api_key = Application.get_env(:web_push_encryption, :gcm_api_key) avatar_url = User.avatar_url(actor) object = Object.normalize(activity) @@ -116,7 +114,7 @@ defmodule Pleroma.Web.Push.Impl do end def build_content(notification, actor, object, mastodon_type) do - mastodon_type = mastodon_type || mastodon_notification_type(notification.activity) + mastodon_type = mastodon_type || notification.type %{ title: format_title(notification, mastodon_type), @@ -151,7 +149,7 @@ defmodule Pleroma.Web.Push.Impl do mastodon_type ) when type in ["Follow", "Like"] do - mastodon_type = mastodon_type || mastodon_notification_type(notification.activity) + mastodon_type = mastodon_type || notification.type case mastodon_type do "follow" -> "@#{actor.nickname} has followed you" @@ -166,10 +164,8 @@ defmodule Pleroma.Web.Push.Impl do "New Direct Message" end - def format_title(%{activity: activity}, mastodon_type) do - mastodon_type = mastodon_type || mastodon_notification_type(activity) - - case mastodon_type do + def format_title(%{type: type}, mastodon_type) do + case mastodon_type || type do "mention" -> "New Mention" "follow" -> "New Follower" "follow_request" -> "New Follow Request" |