aboutsummaryrefslogtreecommitdiff
path: root/lib/pleroma/web/push/impl.ex
diff options
context:
space:
mode:
authorIvan Tashkinov <ivantashkinov@gmail.com>2020-04-09 15:13:37 +0300
committerIvan Tashkinov <ivantashkinov@gmail.com>2020-04-09 15:13:37 +0300
commitac672a9d6bfdd3cba7692f80a883bd38b0b09a57 (patch)
treee8a647e2a756d25491957b2ae165a20f816d5049 /lib/pleroma/web/push/impl.ex
parent3965772b261e78669441a5bf3a597f1a69f78a7f (diff)
downloadpleroma-ac672a9d6bfdd3cba7692f80a883bd38b0b09a57.tar.gz
[#1559] Addressed code review requests.
Diffstat (limited to 'lib/pleroma/web/push/impl.ex')
-rw-r--r--lib/pleroma/web/push/impl.ex25
1 files changed, 13 insertions, 12 deletions
diff --git a/lib/pleroma/web/push/impl.ex b/lib/pleroma/web/push/impl.ex
index 89d45b2e1..f1740a6e0 100644
--- a/lib/pleroma/web/push/impl.ex
+++ b/lib/pleroma/web/push/impl.ex
@@ -153,10 +153,10 @@ defmodule Pleroma.Web.Push.Impl do
when type in ["Follow", "Like"] do
mastodon_type = mastodon_type || mastodon_notification_type(notification.activity)
- case {type, mastodon_type} do
- {"Follow", "follow"} -> "@#{actor.nickname} has followed you"
- {"Follow", "follow_request"} -> "@#{actor.nickname} has requested to follow you"
- {"Like", _} -> "@#{actor.nickname} has favorited your post"
+ case mastodon_type do
+ "follow" -> "@#{actor.nickname} has followed you"
+ "follow_request" -> "@#{actor.nickname} has requested to follow you"
+ "favourite" -> "@#{actor.nickname} has favorited your post"
end
end
@@ -166,15 +166,16 @@ defmodule Pleroma.Web.Push.Impl do
"New Direct Message"
end
- def format_title(%{activity: %{data: %{"type" => type}}} = notification, mastodon_type) do
- mastodon_type = mastodon_type || mastodon_notification_type(notification.activity)
+ def format_title(%{activity: activity}, mastodon_type) do
+ mastodon_type = mastodon_type || mastodon_notification_type(activity)
- case {type, mastodon_type} do
- {"Create", _} -> "New Mention"
- {"Follow", "follow"} -> "New Follower"
- {"Follow", "follow_request"} -> "New Follow Request"
- {"Announce", _} -> "New Repeat"
- {"Like", _} -> "New Favorite"
+ case mastodon_type do
+ "mention" -> "New Mention"
+ "follow" -> "New Follower"
+ "follow_request" -> "New Follow Request"
+ "reblog" -> "New Repeat"
+ "favourite" -> "New Favorite"
+ type -> "New #{String.capitalize(type || "event")}"
end
end
end