Don't notify group members & followers from new draft event

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2022-11-22 12:02:55 +01:00
parent aeaf22a224
commit 8e7907ec9e
No known key found for this signature in database
GPG key ID: A061B9DDE0CA0773

View file

@ -14,11 +14,11 @@ defmodule Mobilizon.Service.Workers.EventDelayedNotificationWorker do
@impl Oban.Worker @impl Oban.Worker
def perform(%Job{args: %{"action" => "notify_of_new_event", "event_uuid" => event_uuid}}) do def perform(%Job{args: %{"action" => "notify_of_new_event", "event_uuid" => event_uuid}}) do
case Events.get_event_by_uuid_with_preload(event_uuid) do case Events.get_event_by_uuid_with_preload(event_uuid) do
%Event{} = event -> %Event{draft: false} = event ->
Group.notify_of_new_event(event) Group.notify_of_new_event(event)
nil -> nil ->
# Event deleted inbetween, no worries, just ignore # Event still a draft or event deleted inbetween, no worries, just ignore
:ok :ok
end end
end end
@ -44,7 +44,7 @@ defmodule Mobilizon.Service.Workers.EventDelayedNotificationWorker do
) )
_ -> _ ->
# Event deleted inbetween, no worries, just ignore # Event still a draft or event deleted inbetween, no worries, just ignore
:ok :ok
end end
end end