fix admin elixir

This commit is contained in:
Tykayn 2022-10-12 15:23:22 +02:00 committed by tykayn
parent a89aaf9d09
commit c2a61801c1

View File

@ -132,100 +132,4 @@ defmodule Mobilizon.Web.Email.Admin do
offer_unsupscription: false offer_unsupscription: false
}) })
end end
@spec user_email_change_old(User.t(), String.t()) :: Bamboo.Email.t()
def user_email_change_old(
%User{
locale: user_locale,
email: new_email
},
old_email
) do
Gettext.put_locale(user_locale)
subject =
gettext(
"An administrator manually changed the email attached to your account on %{instance}",
instance: Config.instance_name()
)
Email.base_email(to: old_email, subject: subject)
|> assign(:locale, user_locale)
|> assign(:subject, subject)
|> assign(:new_email, new_email)
|> assign(:old_email, old_email)
|> assign(:offer_unsupscription, false)
|> render(:admin_user_email_changed_old)
end
@spec user_email_change_new(User.t(), String.t()) :: Bamboo.Email.t()
def user_email_change_new(
%User{
locale: user_locale,
email: new_email
},
old_email
) do
Gettext.put_locale(user_locale)
subject =
gettext(
"An administrator manually changed the email attached to your account on %{instance}",
instance: Config.instance_name()
)
Email.base_email(to: new_email, subject: subject)
|> assign(:locale, user_locale)
|> assign(:subject, subject)
|> assign(:old_email, old_email)
|> assign(:new_email, new_email)
|> assign(:offer_unsupscription, false)
|> render(:admin_user_email_changed_new)
end
@spec user_role_change(User.t(), atom()) :: Bamboo.Email.t()
def user_role_change(
%User{
locale: user_locale,
email: email,
role: new_role
},
old_role
) do
Gettext.put_locale(user_locale)
subject =
gettext(
"An administrator updated your role on %{instance}",
instance: Config.instance_name()
)
Email.base_email(to: email, subject: subject)
|> assign(:locale, user_locale)
|> assign(:subject, subject)
|> assign(:old_role, old_role)
|> assign(:new_role, new_role)
|> assign(:offer_unsupscription, false)
|> render(:admin_user_role_changed)
end
@spec user_confirmation(User.t()) :: Bamboo.Email.t()
def user_confirmation(%User{
locale: user_locale,
email: email
}) do
Gettext.put_locale(user_locale)
subject =
gettext(
"An administrator confirmed your account on %{instance}",
instance: Config.instance_name()
)
Email.base_email(to: email, subject: subject)
|> assign(:locale, user_locale)
|> assign(:subject, subject)
|> assign(:offer_unsupscription, false)
|> render(:admin_user_confirmation)
end
end end