Properly log if we can't notify group follower
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
16b1e0080c
commit
035ff134f5
|
@ -11,6 +11,7 @@ defmodule Mobilizon.Web.Email.Group do
|
|||
alias Mobilizon.Events.Event
|
||||
alias Mobilizon.Users.{Setting, User}
|
||||
alias Mobilizon.Web.Email
|
||||
require Logger
|
||||
|
||||
@spec notify_of_new_event(Event.t()) :: :ok
|
||||
def notify_of_new_event(%Event{attributed_to: %Actor{} = group} = event) do
|
||||
|
@ -63,6 +64,20 @@ defmodule Mobilizon.Web.Email.Group do
|
|||
end
|
||||
end
|
||||
|
||||
defp notify_follower(
|
||||
%Event{uuid: event_uuid},
|
||||
%Actor{type: :Group, preferred_username: group_username},
|
||||
user
|
||||
) do
|
||||
Logger.warn(
|
||||
"Unable to notify group follower user #{user.email} for event #{event_uuid} from group #{group_username}"
|
||||
)
|
||||
|
||||
:ok
|
||||
end
|
||||
|
||||
defp notify_follower(_, _, _), do: :ok
|
||||
|
||||
@spec accepts_new_events_notifications(list()) :: boolean()
|
||||
defp accepts_new_events_notifications(activity_settings) do
|
||||
case Enum.find(activity_settings, &(&1.key == "event_created" && &1.method == "email")) do
|
||||
|
|
Loading…
Reference in a new issue