[openstreetmap/openstreetmap-website] Refactor trace notifications to reduce lego translations (#2970)

Andy Allan notifications at github.com
Thu Nov 19 09:42:31 UTC 2020


@gravitystorm commented on this pull request.



> @@ -1,12 +1,8 @@
-<%= t "user_mailer.gpx_notification.your_gpx_file" %>
-<strong><%= @trace_name %></strong>
-<%= t "user_mailer.gpx_notification.with_description" %>
-<em><%= @trace_description %></em>
-<% if @trace_tags.length>0 %>
-  <%= t "user_mailer.gpx_notification.and_the_tags" %>
-  <em><% @trace_tags.each do |tag| %>
-    <%= tag.tag.rstrip %>
-  <% end %></em>
+<% trace_name = tag.strong(@trace_name) %>
+<% trace_description = tag.em(@trace_description) %>
+<% if @trace_tags.length > 0 %>
+  <% tags = @trace_tags.map { tag.tag.rstrip.join(" ") } %>

> and I'll look into the `safe_join` aspect too

Actually, I don't think we want the safe_join here, since `tag.tag` isn't made up of existing safe strings (e.g. already-built html) - `tag.tag` is just a regular string. So `join` is the best approach and the whole string will be properly escaped when interpolated into the erb.

Of course, `join` is still in the wrong place!

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/2970#discussion_r526721954
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20201119/5aaf7a89/attachment.htm>


More information about the rails-dev mailing list