debianize-mobilizon/lib/web/templates/email/activity/_discussion_activity_item.html.heex
Thomas Citharel 470a3e594b
Correctly escape user-defined names in emails
Closes #1151

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
2022-10-31 14:30:40 +01:00

41 lines
2.4 KiB
Plaintext

<%= case @activity.subject do %>
<% :discussion_created -> %>
<%= dgettext("activity", "%{profile} created the discussion %{discussion}.", %{
profile: "<b>#{escaped_display_name_and_username(@activity.author)}</b>",
discussion:
"<a href=\"#{Routes.page_url(Mobilizon.Web.Endpoint, :discussion, Mobilizon.Actors.Actor.preferred_username_and_domain(@activity.group), @activity.subject_params["discussion_slug"]) |> URI.decode()}\">
#{escape_html(@activity.subject_params["discussion_title"])}</a>"
})
|> raw %>
<% :discussion_replied -> %>
<%= dgettext("activity", "%{profile} replied to the discussion %{discussion}.", %{
profile: "<b>#{escaped_display_name_and_username(@activity.author)}</b>",
discussion:
"<a href=\"#{Routes.page_url(Mobilizon.Web.Endpoint, :discussion, Mobilizon.Actors.Actor.preferred_username_and_domain(@activity.group), @activity.subject_params["discussion_slug"]) |> URI.decode()}\">
#{escape_html(@activity.subject_params["discussion_title"])}</a>"
})
|> raw %>
<% :discussion_renamed -> %>
<%= dgettext("activity", "%{profile} renamed the discussion %{discussion}.", %{
profile: "<b>#{escaped_display_name_and_username(@activity.author)}</b>",
discussion:
"<a href=\"#{Routes.page_url(Mobilizon.Web.Endpoint, :discussion, Mobilizon.Actors.Actor.preferred_username_and_domain(@activity.group), @activity.subject_params["discussion_slug"]) |> URI.decode()}\">
#{escape_html(@activity.subject_params["discussion_title"])}</a>"
})
|> raw %>
<% :discussion_archived -> %>
<%= dgettext("activity", "%{profile} archived the discussion %{discussion}.", %{
profile: "<b>#{escaped_display_name_and_username(@activity.author)}</b>",
discussion:
"<a href=\"#{Routes.page_url(Mobilizon.Web.Endpoint, :discussion, Mobilizon.Actors.Actor.preferred_username_and_domain(@activity.group), @activity.subject_params["discussion_slug"]) |> URI.decode()}\">
#{escape_html(@activity.subject_params["discussion_title"])}</a>"
})
|> raw %>
<% :discussion_deleted -> %>
<%= dgettext("activity", "%{profile} deleted the discussion %{discussion}.", %{
profile: "<b>#{escaped_display_name_and_username(@activity.author)}</b>",
discussion: "<b>#{escape_html(@activity.subject_params["discussion_title"])}</b>"
})
|> raw %>
<% end %>