diff --git a/lib/web/email/actor.ex b/lib/web/email/actor.ex index 8e81621c5..f0dd77b2d 100644 --- a/lib/web/email/actor.ex +++ b/lib/web/email/actor.ex @@ -8,8 +8,8 @@ defmodule Mobilizon.Web.Email.Actor do import Mobilizon.Web.Gettext alias Mobilizon.Actors.Actor - alias Mobilizon.{Config, Users} alias Mobilizon.Events.{Event, Participant} + alias Mobilizon.Users alias Mobilizon.Users.User alias Mobilizon.Web.Email @@ -40,7 +40,6 @@ defmodule Mobilizon.Web.Email.Actor do ) do with %User{email: email, locale: locale} <- Users.get_user!(user_id) do Gettext.put_locale(locale) - instance = Config.instance_name() subject = gettext("Your participation to %{event} has been cancelled!", event: event.title) @@ -50,7 +49,6 @@ defmodule Mobilizon.Web.Email.Actor do |> assign(:event, event) |> assign(:role, member_role) |> assign(:subject, subject) - |> assign(:instance, instance) |> render(:actor_suspension_participants) |> Email.Mailer.send_email_later() diff --git a/lib/web/email/email.ex b/lib/web/email/email.ex index 18b9639de..c80bd854d 100644 --- a/lib/web/email/email.ex +++ b/lib/web/email/email.ex @@ -12,15 +12,13 @@ defmodule Mobilizon.Web.Email do @spec base_email(keyword()) :: Bamboo.Email.t() def base_email(args) do - instance = Config.instance_config() - args |> new_email() |> from({Config.instance_name(), Config.instance_email_from()}) |> put_header("Reply-To", Config.instance_email_reply_to()) |> maybe_put_date_header() |> maybe_put_message_id() - |> assign(:instance, instance) + |> assign(:instance_name, Config.instance_name()) |> put_html_layout({EmailView, "email.html"}) |> put_text_layout({EmailView, "email.text"}) end diff --git a/lib/web/email/group.ex b/lib/web/email/group.ex index bf1ecdc18..6a81fd399 100644 --- a/lib/web/email/group.ex +++ b/lib/web/email/group.ex @@ -92,13 +92,12 @@ defmodule Mobilizon.Web.Email.Group do }) do with %User{email: email, locale: locale} <- Users.get_user!(user_id) do Gettext.put_locale(locale) - instance = Config.instance_name() subject = gettext( "The group %{group} has been suspended on %{instance}", group: group.name, - instance: instance + instance: Config.instance_name() ) Email.base_email(to: email, subject: subject) @@ -106,7 +105,6 @@ defmodule Mobilizon.Web.Email.Group do |> assign(:group, group) |> assign(:role, member_role) |> assign(:subject, subject) - |> assign(:instance, instance) |> render(:group_suspension) |> Email.Mailer.send_email_later() diff --git a/lib/web/email/user.ex b/lib/web/email/user.ex index 66ccb2137..1ad29b711 100644 --- a/lib/web/email/user.ex +++ b/lib/web/email/user.ex @@ -172,19 +172,17 @@ defmodule Mobilizon.Web.Email.User do _locale \\ "en" ) do Gettext.put_locale(user_locale) - instance_name = Config.instance_name() subject = gettext( "Mobilizon on %{instance}: confirm your email address", - instance: instance_name + instance: Config.instance_name() ) Email.base_email(to: unconfirmed_email, subject: subject) |> assign(:locale, user_locale) |> assign(:subject, subject) |> assign(:token, confirmation_token) - |> assign(:instance_name, instance_name) |> render(:email_changed_new) end diff --git a/lib/web/templates/email/actor_suspension_participants.html.eex b/lib/web/templates/email/actor_suspension_participants.html.eex index 10c150ae9..4e3ea2472 100644 --- a/lib/web/templates/email/actor_suspension_participants.html.eex +++ b/lib/web/templates/email/actor_suspension_participants.html.eex @@ -10,7 +10,7 @@

- <%= gettext "Your participation to %{event} has been cancelled!", event: (@event.title), instance: @instance %> + <%= gettext "Your participation to %{event} has been cancelled!", event: (@event.title), instance: @instance_name %>

diff --git a/lib/web/templates/email/actor_suspension_participants.text.eex b/lib/web/templates/email/actor_suspension_participants.text.eex index cb05eb2e4..c467b117c 100644 --- a/lib/web/templates/email/actor_suspension_participants.text.eex +++ b/lib/web/templates/email/actor_suspension_participants.text.eex @@ -1,3 +1,3 @@ -<%= gettext "Your participation to %{event} has been cancelled!", event: (@event.title), instance: @instance %> +<%= gettext "Your participation to %{event} has been cancelled!", event: (@event.title), instance: @instance_name %> == <%= gettext "Your instance's moderation team has decided to suspend %{actor_name} (%{actor_address}). All of their events have been removed and your participation cancelled.", group_name: @actor.name || @actor.preferred_username, actor_address: if @actor.domain, do: "@#{@actor.preferred_username}@#{@actor.domain}", else: "@#{@actor.preferred_username}" %> diff --git a/lib/web/templates/email/email.html.eex b/lib/web/templates/email/email.html.eex index 55ccf9e3f..0881f9f18 100644 --- a/lib/web/templates/email/email.html.eex +++ b/lib/web/templates/email/email.html.eex @@ -56,7 +56,7 @@ - <%= Mobilizon.Config.instance_name() %>" width="366" height="108" style="display: block; width: 366px; max-width: 366px; min-width: 366px; font-family: 'Roboto', Helvetica, Arial, sans-serif; color: #ffffff; font-size: 18px;" border="0"> + <%= @instance_name %>" width="366" height="108" style="display: block; width: 366px; max-width: 366px; min-width: 366px; font-family: 'Roboto', Helvetica, Arial, sans-serif; color: #ffffff; font-size: 18px;" border="0"> @@ -140,7 +140,7 @@

- <%= gettext("%{instance} is powered by Mobilizon.", instance: @instance[:name]) |> raw %>
+ <%= gettext("%{instance} is powered by Mobilizon.", instance: @instance_name) |> raw %>
<%= gettext "Learn more about Mobilizon here!" %>

diff --git a/lib/web/templates/email/email.text.eex b/lib/web/templates/email/email.text.eex index e030103f7..24812de6c 100644 --- a/lib/web/templates/email/email.text.eex +++ b/lib/web/templates/email/email.text.eex @@ -8,4 +8,4 @@ <%= gettext "Need help? Is something not working as expected?" %> <%= gettext "Ask the community on Framacolibri" %> https://framacolibri.org/c/mobilizon/39 -<%= gettext "%{instance} is powered by Mobilizon.", instance: @instance[:name] %> <%= gettext "Learn more about Mobilizon here!" %> https://joinmobilizon.org +<%= gettext "%{instance} is powered by Mobilizon.", instance: @instance_name %> <%= gettext "Learn more about Mobilizon here!" %> https://joinmobilizon.org diff --git a/lib/web/templates/email/email_changed_old.html.eex b/lib/web/templates/email/email_changed_old.html.eex index ab5ea3e7e..164155a46 100644 --- a/lib/web/templates/email/email_changed_old.html.eex +++ b/lib/web/templates/email/email_changed_old.html.eex @@ -35,7 +35,7 @@

- <%= gettext("The email address for your account on %{host} is being changed to:", host: @instance[:name]) |> raw %> + <%= gettext("The email address for your account on %{host} is being changed to:", host: @instance_name) |> raw %>

@@ -59,7 +59,7 @@

- <%= gettext("If you did not trigger this change yourself, it is likely that someone has gained access to your %{host} account. Please log in and change your password immediately. If you cannot login, contact the admin on %{host}.", host: @instance[:name]) %> + <%= gettext("If you did not trigger this change yourself, it is likely that someone has gained access to your %{host} account. Please log in and change your password immediately. If you cannot login, contact the admin on %{host}.", host: @instance_name) %>

diff --git a/lib/web/templates/email/email_changed_old.text.eex b/lib/web/templates/email/email_changed_old.text.eex index 287a37670..8c859dad5 100644 --- a/lib/web/templates/email/email_changed_old.text.eex +++ b/lib/web/templates/email/email_changed_old.text.eex @@ -1,5 +1,5 @@ <%= gettext "New email confirmation" %> == -<%= gettext "Hi there! Just a quick note to confirm that the email address linked to your account on %{host} has been changed from this one to:", host: @instance[:name] %> +<%= gettext "Hi there! Just a quick note to confirm that the email address linked to your account on %{host} has been changed from this one to:", host: @instance_name %> <%= @new_email %> -<%= gettext "If you did not trigger this change yourself, it is likely that someone has gained access to your %{host} account. Please log in and change your password immediately. If you cannot login, contact the admin on %{host}.", host: @instance[:name] %> +<%= gettext "If you did not trigger this change yourself, it is likely that someone has gained access to your %{host} account. Please log in and change your password immediately. If you cannot login, contact the admin on %{host}.", host: @instance_name %> diff --git a/lib/web/templates/email/group_suspension.html.eex b/lib/web/templates/email/group_suspension.html.eex index bac40a548..8c5ced29d 100644 --- a/lib/web/templates/email/group_suspension.html.eex +++ b/lib/web/templates/email/group_suspension.html.eex @@ -10,7 +10,7 @@

- <%= gettext "The group %{group} has been suspended on %{instance}!", group: (@group.name || @group.preferred_username), instance: @instance %> + <%= gettext "The group %{group} has been suspended on %{instance}!", group: (@group.name || @group.preferred_username), instance: @instance_name %>

diff --git a/lib/web/templates/email/group_suspension.text.eex b/lib/web/templates/email/group_suspension.text.eex index 02b870c65..13b72f201 100644 --- a/lib/web/templates/email/group_suspension.text.eex +++ b/lib/web/templates/email/group_suspension.text.eex @@ -1,4 +1,4 @@ -<%= gettext "The group %{group} has been suspended on %{instance}!", group: (@group.name || @group.preferred_username), instance: @instance %> +<%= gettext "The group %{group} has been suspended on %{instance}!", group: (@group.name || @group.preferred_username), instance: @instance_name %> == <%= gettext "Your instance's moderation team has decided to suspend %{group_name} (%{group_address}). You are no longer a member of this group.", group_name: @group.name, group_address: if @group.domain, do: "@#{@group.preferred_username}@#{@group.domain}", else: "@#{@group.preferred_username}" %> <%= if is_nil(@group.domain) do %> diff --git a/lib/web/templates/email/password_reset.html.eex b/lib/web/templates/email/password_reset.html.eex index e00051d6a..ccd810a45 100644 --- a/lib/web/templates/email/password_reset.html.eex +++ b/lib/web/templates/email/password_reset.html.eex @@ -35,7 +35,7 @@

- <%= gettext("You requested a new password for your account on %{instance}.", instance: @instance[:name]) |> raw %> + <%= gettext("You requested a new password for your account on %{instance}.", instance: @instance_name) |> raw %>

<%= gettext "Resetting your password is easy. Just press the button below and follow the instructions. We'll have you up and running in no time." %> diff --git a/lib/web/templates/email/password_reset.text.eex b/lib/web/templates/email/password_reset.text.eex index eafe62dac..91513e3f1 100644 --- a/lib/web/templates/email/password_reset.text.eex +++ b/lib/web/templates/email/password_reset.text.eex @@ -2,7 +2,7 @@ == -<%= gettext "You requested a new password for your account on %{instance}.", instance: @instance[:name] %> +<%= gettext "You requested a new password for your account on %{instance}.", instance: @instance_name %> <%= gettext "Resetting your password is easy. Just click the link below and follow the instructions. We'll have you up and running in no time." %> diff --git a/lib/web/templates/email/registration_confirmation.html.eex b/lib/web/templates/email/registration_confirmation.html.eex index e35e3370d..89fbce362 100644 --- a/lib/web/templates/email/registration_confirmation.html.eex +++ b/lib/web/templates/email/registration_confirmation.html.eex @@ -35,7 +35,7 @@

- <%= gettext("You created an account on %{host} with this email address. You are one click away from activating it.", host: @instance[:name]) |> raw %> + <%= gettext("You created an account on %{host} with this email address. You are one click away from activating it.", host: @instance_name) |> raw %>

diff --git a/lib/web/templates/email/registration_confirmation.text.eex b/lib/web/templates/email/registration_confirmation.text.eex index ad53b009b..a5298826a 100644 --- a/lib/web/templates/email/registration_confirmation.text.eex +++ b/lib/web/templates/email/registration_confirmation.text.eex @@ -2,6 +2,6 @@ == -<%= gettext "You created an account on %{host} with this email address. You are one click away from activating it. If this wasn't you, please ignore this email.", host: @instance[:name] %> +<%= gettext "You created an account on %{host} with this email address. You are one click away from activating it. If this wasn't you, please ignore this email.", host: @instance_name %> <%= Mobilizon.Web.Endpoint.url() <> "/validate/#{@token}" %> diff --git a/lib/web/templates/email/report.html.eex b/lib/web/templates/email/report.html.eex index b25939438..f2fa83c75 100644 --- a/lib/web/templates/email/report.html.eex +++ b/lib/web/templates/email/report.html.eex @@ -10,7 +10,7 @@

- <%= gettext("New report on %{instance}", instance: @instance[:name]) |> raw %> + <%= gettext("New report on %{instance}", instance: @instance_name) |> raw %>

diff --git a/lib/web/templates/email/report.text.eex b/lib/web/templates/email/report.text.eex index 7cd119b57..8e652a3c9 100644 --- a/lib/web/templates/email/report.text.eex +++ b/lib/web/templates/email/report.text.eex @@ -1,4 +1,4 @@ -<%= gettext "New report from %{reporter} on %{instance}", reporter: Mobilizon.Actors.Actor.display_name_and_username(@report.reporter), instance: @instance[:name] %> +<%= gettext "New report from %{reporter} on %{instance}", reporter: Mobilizon.Actors.Actor.display_name_and_username(@report.reporter), instance: @instance_name %> -- <%= if @report.reported do %> <%= if @report.reported.type == :Group do %>