From 035ff134f5cd951a285a0907ddb1382e675ce65d Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Mon, 7 Nov 2022 19:44:16 +0100 Subject: [PATCH] Properly log if we can't notify group follower Signed-off-by: Thomas Citharel --- lib/web/email/group.ex | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/web/email/group.ex b/lib/web/email/group.ex index 964028fcb..da29082b4 100644 --- a/lib/web/email/group.ex +++ b/lib/web/email/group.ex @@ -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