Refactor Mobilizon.Federation.ActivityPub and add typespecs
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
@@ -49,6 +49,7 @@ defmodule Mobilizon.Web.Email.Event do
|
||||
|> render(:event_updated)
|
||||
end
|
||||
|
||||
@spec calculate_event_diff_and_send_notifications(Event.t(), Event.t(), map()) :: {:ok, :ok}
|
||||
def calculate_event_diff_and_send_notifications(
|
||||
%Event{} = old_event,
|
||||
%Event{id: event_id} = event,
|
||||
@@ -75,6 +76,12 @@ defmodule Mobilizon.Web.Email.Event do
|
||||
end
|
||||
end
|
||||
|
||||
@spec send_notification_for_event_update_to_participant(
|
||||
{Participant.t(), Actor.t(), User.t() | nil, Setting.t() | nil},
|
||||
Event.t(),
|
||||
Event.t(),
|
||||
MapSet.t()
|
||||
) :: Bamboo.Email.t()
|
||||
defp send_notification_for_event_update_to_participant(
|
||||
{%Participant{} = _participant, %Actor{} = actor,
|
||||
%User{locale: locale, email: email} = _user, %Setting{timezone: timezone}},
|
||||
@@ -131,6 +138,15 @@ defmodule Mobilizon.Web.Email.Event do
|
||||
)
|
||||
end
|
||||
|
||||
@spec do_send_notification_for_event_update_to_participant(
|
||||
String.t(),
|
||||
Actor.t(),
|
||||
Event.t(),
|
||||
Event.t(),
|
||||
MapSet.t(),
|
||||
String.t(),
|
||||
String.t()
|
||||
) :: Bamboo.Email.t()
|
||||
defp do_send_notification_for_event_update_to_participant(
|
||||
email,
|
||||
actor,
|
||||
|
||||
@@ -34,6 +34,8 @@ defmodule Mobilizon.Web.Email.Notification do
|
||||
|> render(:before_event_notification)
|
||||
end
|
||||
|
||||
@spec on_day_notification(User.t(), list(Participant.t()), pos_integer(), String.t()) ::
|
||||
Bamboo.Email.t()
|
||||
def on_day_notification(
|
||||
%User{email: email, settings: %Setting{timezone: timezone}},
|
||||
participations,
|
||||
@@ -58,6 +60,8 @@ defmodule Mobilizon.Web.Email.Notification do
|
||||
|> render(:on_day_notification)
|
||||
end
|
||||
|
||||
@spec weekly_notification(User.t(), list(Participant.t()), pos_integer(), String.t()) ::
|
||||
Bamboo.Email.t()
|
||||
def weekly_notification(
|
||||
%User{email: email, settings: %Setting{timezone: timezone}},
|
||||
participations,
|
||||
@@ -82,6 +86,7 @@ defmodule Mobilizon.Web.Email.Notification do
|
||||
|> render(:notification_each_week)
|
||||
end
|
||||
|
||||
@spec pending_participation_notification(User.t(), Event.t(), pos_integer()) :: Bamboo.Email.t()
|
||||
def pending_participation_notification(
|
||||
%User{locale: locale, email: email},
|
||||
%Event{} = event,
|
||||
|
||||
Reference in New Issue
Block a user