diff options
author | Alexander Strizhakov <alex.strizhakov@gmail.com> | 2020-06-17 18:39:20 +0300 |
---|---|---|
committer | Alexander Strizhakov <alex.strizhakov@gmail.com> | 2021-03-10 16:46:55 +0300 |
commit | 46492a2aee53e7d0849faae6837423da3812b993 (patch) | |
tree | a065af0b65c904c0df004c2a052d86bd34e90c2b /lib | |
parent | a74d0f8b27e7a93ce31f9569ef29f7b40fc4235f (diff) | |
download | pleroma-46492a2aee53e7d0849faae6837423da3812b993.tar.gz |
set alert types in compile time
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/web/push/subscription.ex | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/pleroma/web/push/subscription.ex b/lib/pleroma/web/push/subscription.ex index 7ea32b258..61e34fbba 100644 --- a/lib/pleroma/web/push/subscription.ex +++ b/lib/pleroma/web/push/subscription.ex @@ -14,6 +14,8 @@ defmodule Pleroma.Web.Push.Subscription do @type t :: %__MODULE__{} + @supported_alert_types Enum.map(Pleroma.Notification.types(), &String.to_atom/1) + schema "push_subscriptions" do belongs_to(:user, User, type: FlakeId.Ecto.CompatType) belongs_to(:token, Token) @@ -29,8 +31,7 @@ defmodule Pleroma.Web.Push.Subscription do @supported_alert_types ~w[follow favourite mention reblog pleroma:chat_mention pleroma:emoji_reaction]a defp alerts(%{data: %{alerts: alerts}}) do - types = Enum.map(Pleroma.Notification.types(), &String.to_atom/1) - alerts = Map.take(alerts, types) + alerts = Map.take(alerts, @supported_alert_types) %{"alerts" => alerts} end |