Fixes for email

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2019-09-24 12:09:43 +02:00
parent 8c97dd925f
commit 8006b8e0f3
10 changed files with 53 additions and 56 deletions

View File

@@ -29,7 +29,6 @@ defmodule MobilizonWeb.Email.Admin do
|> assign(:locale, locale)
|> assign(:subject, subject)
|> assign(:report, report)
|> render("report.html")
|> Email.premail()
|> render(:report)
end
end

View File

@@ -16,15 +16,6 @@ defmodule MobilizonWeb.Email do
|> put_header("Reply-To", Config.instance_email_reply_to())
|> assign(:instance, instance)
|> put_html_layout({MobilizonWeb.EmailView, "email.html"})
|> put_text_layout(false)
end
def premail(email) do
html = Premailex.to_inline_css(email.html_body)
text = Premailex.to_text(email.html_body)
email
|> html_body(html)
|> text_body(text)
|> put_text_layout({MobilizonWeb.EmailView, "email.text"})
end
end

View File

@@ -31,8 +31,7 @@ defmodule MobilizonWeb.Email.User do
|> assign(:locale, locale)
|> assign(:token, confirmation_token)
|> assign(:subject, subject)
|> render("registration_confirmation.html")
|> Email.premail()
|> render(:registration_confirmation)
end
@spec reset_password_email(User.t(), String.t()) :: Bamboo.Email.t()
@@ -52,7 +51,6 @@ defmodule MobilizonWeb.Email.User do
|> assign(:locale, locale)
|> assign(:token, reset_password_token)
|> assign(:subject, subject)
|> render("password_reset.html")
|> Email.premail()
|> render(:password_reset)
end
end

View File

@@ -1,3 +1,6 @@
<%= render @view_module, @view_template, assigns %>
<%= gettext "An email sent by Mobilizon on %{instance}.", instance: @instance %>
--
<%= gettext "%{instance} is a Mobilizon server.", instance: @instance[:name] %> <%= gettext "Learn more about Mobilizon:" %> https://joinmobilizon.org

View File

@@ -74,32 +74,4 @@
</table>
<![endif]-->
</td>
</tr>
<!-- SUPPORT CALLOUT -->
<tr>
<td bgcolor="#f4f4f4" align="center" style="padding: 30px 10px 0px 10px;">
<!--[if (gte mso 9)|(IE)]>
<table align="center" border="0" cellspacing="0" cellpadding="0" width="600">
<tr>
<td align="center" valign="top" width="600">
<![endif]-->
<table border="0" cellpadding="0" cellspacing="0" width="100%" style="max-width: 600px;" >
<!-- HEADLINE -->
<tr>
<td bgcolor="#C6C2ED" align="center" style="padding: 30px 30px 30px 30px; border-radius: 4px 4px 4px 4px; color: #666666; font-family: 'Lato', Helvetica, Arial, sans-serif; font-size: 18px; font-weight: 400; line-height: 25px;" >
<h2 style="font-size: 20px; font-weight: 400; color: #111111; margin: 0;">
<%= gettext "Need some help? Something not working properly?" %>
</h2>
<p style="margin: 0;"><a href="https://framacolibri.org/c/mobilizon" target="_blank" style="color: #424056;">
<%= gettext "Ask the community on Framacolibri" %>
</a></p>
</td>
</tr>
</table>
<!--[if (gte mso 9)|(IE)]>
</td>
</tr>
</table>
<![endif]-->
</td>
</tr>

View File

@@ -0,0 +1,12 @@
<%= gettext "Password reset" %>
==
<%= gettext "You requested a new password for your account on %{host}.", host: @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." %>
<%= MobilizonWeb.Endpoint.url() <> "/password-reset/#{@token}" %>
<%= gettext "If you didn't request this, please ignore this email. Your password won't change until you access the link below and create a new one." %>

View File

@@ -0,0 +1,7 @@
<%= gettext "Activate your account" %>
==
<%= 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] %>
<%= MobilizonWeb.Endpoint.url() <> "/validate/#{@token}" %>

View File

@@ -0,0 +1,23 @@
<%= gettext "New report from %{reporter} on %{instance}", reporter: @report.reporter.preferred_username, instance: @instance[:name] %>
--
<%= if Map.has_key?(@report, :event) do %>
<%= gettext "Event" %>
<%= @report.event.title %>
<% end %>
<%= if Map.has_key?(@report, :comments) && length(@report.comments) > 0 do %>
<%= gettext "Comments" %>
<%= for comment <- @report.comments do %>
<%= comment.text %>
<% end %>
<% end %>
<%= if @report.content do %>
<%= gettext "Reason" %>
<%= @report.content %>
<% end %>
View the report: <%= moderation_report_url(MobilizonWeb.Endpoint, :index, @report.id) %>