1
0
Fork 0
mirror of https://framagit.org/framasoft/mobilizon.git synced 2024-12-22 16:03:25 +00:00

fix(backend): only send suspension notification emails when actor's suspended and not just deleted

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2023-12-04 09:02:38 +01:00
parent 51e1ed642c
commit 9e41bc1ad6
No known key found for this signature in database
GPG key ID: A061B9DDE0CA0773
2 changed files with 13 additions and 6 deletions

View file

@ -35,13 +35,17 @@ defmodule Mobilizon.Service.ActorSuspension do
delete_actor_options = Keyword.merge(@delete_actor_default_options, options)
Logger.debug(inspect(delete_actor_options))
send_suspension_notification(actor)
# Only send suspension notifications if we actually are suspending the actor
if Keyword.get(delete_actor_options, :suspension, false) do
send_suspension_notification(actor)
Logger.debug(
"Sending suspension notifications to participants from events created by this actor"
)
Logger.debug(
"Sending suspension notifications to participants from events created by this actor"
)
notify_event_participants_from_suspension(actor)
end
notify_event_participants_from_suspension(actor)
delete_participations(actor)
multi =

View file

@ -20,7 +20,10 @@ defmodule Mobilizon.Service.Workers.Background do
reserve_username when is_boolean(reserve_username) ->
case Actors.get_actor(actor_id) do
%Actor{} = actor ->
ActorSuspension.suspend_actor(actor, reserve_username: reserve_username)
ActorSuspension.suspend_actor(actor,
reserve_username: reserve_username,
suspension: Map.get(args, "suspension", false)
)
nil ->
{:error, :actor_not_found}