Various refactoring and typespec improvements
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
@@ -12,7 +12,7 @@ defmodule Mobilizon.Service.Notifier.Email do
|
||||
|
||||
import Mobilizon.Service.DateTime,
|
||||
only: [
|
||||
is_delay_ok_since_last_notification_sent: 1
|
||||
is_delay_ok_since_last_notification_sent?: 1
|
||||
]
|
||||
|
||||
require Logger
|
||||
@@ -116,7 +116,7 @@ defmodule Mobilizon.Service.Notifier.Email do
|
||||
|
||||
# Delay ok since last notification
|
||||
defp match_group_notifications_setting(:one_hour, _, %DateTime{} = last_notification_sent, _) do
|
||||
is_delay_ok_since_last_notification_sent(last_notification_sent)
|
||||
is_delay_ok_since_last_notification_sent?(last_notification_sent)
|
||||
end
|
||||
|
||||
# This is a recap
|
||||
|
||||
@@ -66,12 +66,14 @@ defmodule Mobilizon.Service.Notifier.Push do
|
||||
Map.get(@default_behavior, activity_setting, false)
|
||||
end
|
||||
|
||||
@spec send_subscription(Activity.t(), any, Keyword.t()) :: no_return
|
||||
defp send_subscription(activity, subscription, options) do
|
||||
activity
|
||||
|> payload(options)
|
||||
|> WebPushEncryption.send_web_push(subscription)
|
||||
end
|
||||
|
||||
@spec payload(Activity.t(), Keyword.t()) :: String.t()
|
||||
defp payload(%Activity{} = activity, options) do
|
||||
activity
|
||||
|> Utils.add_activity_object()
|
||||
|
||||
Reference in New Issue
Block a user