Merge branch 'suspension-fixes' into 'main'
fix(backend): only send suspension notification emails when actor's suspended and not just deleted See merge request framasoft/mobilizon!1492
This commit is contained in:
commit
3851392225
|
@ -35,6 +35,8 @@ defmodule Mobilizon.Service.ActorSuspension do
|
||||||
delete_actor_options = Keyword.merge(@delete_actor_default_options, options)
|
delete_actor_options = Keyword.merge(@delete_actor_default_options, options)
|
||||||
Logger.debug(inspect(delete_actor_options))
|
Logger.debug(inspect(delete_actor_options))
|
||||||
|
|
||||||
|
# Only send suspension notifications if we actually are suspending the actor
|
||||||
|
if Keyword.get(delete_actor_options, :suspension, false) do
|
||||||
send_suspension_notification(actor)
|
send_suspension_notification(actor)
|
||||||
|
|
||||||
Logger.debug(
|
Logger.debug(
|
||||||
|
@ -42,6 +44,8 @@ defmodule Mobilizon.Service.ActorSuspension do
|
||||||
)
|
)
|
||||||
|
|
||||||
notify_event_participants_from_suspension(actor)
|
notify_event_participants_from_suspension(actor)
|
||||||
|
end
|
||||||
|
|
||||||
delete_participations(actor)
|
delete_participations(actor)
|
||||||
|
|
||||||
multi =
|
multi =
|
||||||
|
|
|
@ -20,7 +20,10 @@ defmodule Mobilizon.Service.Workers.Background do
|
||||||
reserve_username when is_boolean(reserve_username) ->
|
reserve_username when is_boolean(reserve_username) ->
|
||||||
case Actors.get_actor(actor_id) do
|
case Actors.get_actor(actor_id) do
|
||||||
%Actor{} = actor ->
|
%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 ->
|
nil ->
|
||||||
{:error, :actor_not_found}
|
{:error, :actor_not_found}
|
||||||
|
|
Loading…
Reference in a new issue