refactor: use dedicated email for event announcements
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
@@ -46,6 +46,7 @@ defmodule Mobilizon.Web.Email.Activity do
|
||||
options
|
||||
) do
|
||||
locale = Keyword.get(options, :locale, "en")
|
||||
Gettext.put_locale(locale)
|
||||
|
||||
subject =
|
||||
dgettext(
|
||||
@@ -54,8 +55,6 @@ defmodule Mobilizon.Web.Email.Activity do
|
||||
event: subject_params["conversation_event_title"]
|
||||
)
|
||||
|
||||
conversation = Mobilizon.Conversations.get_conversation(activity.object_id)
|
||||
|
||||
Logger.debug("Going to send anonymous activity of type #{activity.type} to #{email}")
|
||||
|
||||
[to: email, subject: subject]
|
||||
@@ -63,15 +62,13 @@ defmodule Mobilizon.Web.Email.Activity do
|
||||
|> render_body(:email_anonymous_activity, %{
|
||||
subject: subject,
|
||||
activity: activity,
|
||||
locale: locale,
|
||||
extra: %{
|
||||
"conversation" => conversation
|
||||
}
|
||||
locale: locale
|
||||
})
|
||||
end
|
||||
|
||||
def anonymous_activity(email, %Activity{subject_params: subject_params} = activity, options) do
|
||||
locale = Keyword.get(options, :locale, "en")
|
||||
Gettext.put_locale(locale)
|
||||
|
||||
subject =
|
||||
dgettext(
|
||||
|
||||
@@ -113,9 +113,7 @@
|
||||
event:
|
||||
"<a href=\"#{Routes.page_url(Mobilizon.Web.Endpoint,
|
||||
:event,
|
||||
@activity.subject_params["conversation_event_uuid"]) |> URI.decode()}\">
|
||||
#{escape_html(@activity.subject_params["conversation_event_title"])}
|
||||
</a>"
|
||||
@activity.subject_params["conversation_event_uuid"]) |> URI.decode()}\">#{escape_html(@activity.subject_params["conversation_event_title"])}</a>"
|
||||
}
|
||||
)
|
||||
|> raw %>
|
||||
@@ -137,7 +135,7 @@
|
||||
<tr>
|
||||
<td align="center">
|
||||
<blockquote style="border-left-width: 0.25rem;border-left-color: #e2e8f0;border-left-style: solid;padding-left: 1em;margin: 0;text-align: start;color: #474467;font-family: 'Roboto', Helvetica, Arial, sans-serif; font-size: 16px; font-weight: 400;line-height: 25px;">
|
||||
<%= @extra["conversation"].last_comment.text
|
||||
<%= @activity.subject_params["conversation_text"]
|
||||
|> sanitize_to_basic_html()
|
||||
|> raw() %>
|
||||
</blockquote>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
--
|
||||
|
||||
<%= @extra["conversation"].last_comment.text |> html_to_text() |> mail_quote() %>
|
||||
<%= @activity.subject_params["conversation_text"] |> html_to_text() |> mail_quote() %>
|
||||
|
||||
--
|
||||
|
||||
|
||||
Reference in New Issue
Block a user