From e6d19586dffa03e6fac4961c0a1b64b6a237d88d Mon Sep 17 00:00:00 2001 From: Herve Saint-Amand Date: Thu, 29 Dec 2016 21:54:46 +0000 Subject: [PATCH 01/42] intial commit, for 'en' locale only, for changeset_comment_notification only, doesn't load images properly yet --- app/models/notifier.rb | 67 +++++++++++++ .../changeset_comment_notification.html.erb | 94 +++++++++++++++---- config/locales/en.yml | 15 ++- 3 files changed, 151 insertions(+), 25 deletions(-) diff --git a/app/models/notifier.rb b/app/models/notifier.rb index 0539bdeb72..b53210c30e 100644 --- a/app/models/notifier.rb +++ b/app/models/notifier.rb @@ -1,3 +1,5 @@ +require "base64" + class Notifier < ActionMailer::Base default :from => EMAIL_FROM, :return_path => EMAIL_RETURN_PATH, @@ -154,10 +156,13 @@ def note_comment_notification(comment, recipient) def changeset_comment_notification(comment, recipient) with_recipient_locale recipient do + @root_url = root_url(:host => SERVER_URL) @changeset_url = changeset_url(comment.changeset, :host => SERVER_URL) @comment = comment.body @owner = recipient == comment.changeset.user @commenter = comment.author.display_name + @commenter_url = user_url(comment.author.display_name, :host => SERVER_URL) + @commenter_thumbnail_src = comment.author.image.url(:small, :host => SERVER_URL) @changeset_comment = comment.changeset.tags["comment"].presence @time = comment.created_at @changeset_author = comment.changeset.user.display_name @@ -168,6 +173,12 @@ def changeset_comment_notification(comment, recipient) I18n.t("notifier.changeset_comment_notification.commented.subject_other", :commenter => @commenter) end + attachments.inline['osm_logo_30x30.png'] = { + mime_type: 'image/png', + encoding: 'base64', + content: @@osm_logo_png_bytes, + } + mail :to => recipient.email, :subject => subject end end @@ -191,4 +202,60 @@ def from_address(name, type, id, digest, user_id = nil) EMAIL_FROM end end + + # FIXME - 2016-12-28 - saintamh - someone please show me a better way to + # include this blob in here. If I save it under app/assets, how do I get a + # path to it in a portable way? + @@osm_logo_png_bytes = <<%= t 'notifier.changeset_comment_notification.greeting' %>

- -

- <% if @owner %> - <%= t "notifier.changeset_comment_notification.commented.your_changeset", :commenter => @commenter, :time => @time %> - <% else %> - <%= t "notifier.changeset_comment_notification.commented.commented_changeset", :commenter => @commenter, :time => @time, :changeset_author => @changeset_author %> - <% end %> - <% if @changeset_comment %> - <%= t "notifier.changeset_comment_notification.commented.partial_changeset_with_comment", :changeset_comment => @changeset_comment %> - <% else %> - <%= t "notifier.changeset_comment_notification.commented.partial_changeset_without_comment" %> - <% end %> -

- -== -<%= @comment.to_html %> -== - -

<%= raw t 'notifier.changeset_comment_notification.details', :url => link_to(@changeset_url, @changeset_url) %>

+ + + + + + + + + + + + + +
+ + + + + + + + +
+ + <%= image_tag attachments["osm_logo_30x30.png"].url, alt: "OpenStreetMap logo", title: "OpenStreetMap", height: "30", width: "30", border: "0" %> + + + +

OpenStreetMap

+
+
+ + + + +
+

+ <% if @owner %> + <%= t "notifier.changeset_comment_notification.commented.your_changeset_html", :commenter => @commenter, :commenter_url => @commenter_url, :time => @time %> + <% else %> + <%= t "notifier.changeset_comment_notification.commented.commented_changeset_html", :commenter => @commenter, :commenter_url => @commenter_url, :time => @time, :changeset_author => @changeset_author %> + <% end %> + <% if @changeset_comment %> + <%= t "notifier.changeset_comment_notification.commented.partial_changeset_with_comment_html", :changeset_comment => @changeset_comment %> + <% else %> + <%= t "notifier.changeset_comment_notification.commented.partial_changeset_without_comment" %> + <% end %> +

+ + + + + +
+ + + <%= @comment.to_html %> +
+

+

<%= raw t 'notifier.changeset_comment_notification.details_html', :url => link_to(@changeset_url, @changeset_url) %>

+

+
+
+
+

+ Unsubscribe + from updates to this changeset +

+

+ OpenStreetMap.org +

+
+ + diff --git a/config/locales/en.yml b/config/locales/en.yml index cfff874bda..52994509fa 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1315,10 +1315,20 @@ en: subject_own: "[OpenStreetMap] %{commenter} has commented on one of your changesets" subject_other: "[OpenStreetMap] %{commenter} has commented on a changeset you are interested in" your_changeset: "%{commenter} has left a comment on one of your changesets created at %{time}" + your_changeset_html: '%{commenter} + has left a comment on one of your changesets + created at %{time}' commented_changeset: "%{commenter} has left a comment on a map changeset you are watching created by %{changeset_author} at %{time}" + commented_changeset_html: '%{commenter} + has left a comment on a map changeset you are watching created by + %{changeset_author} + at %{time}' partial_changeset_with_comment: "with comment '%{changeset_comment}'" + partial_changeset_with_comment_html: 'with comment %{changeset_comment}' partial_changeset_without_comment: "without comment" details: "More details about the changeset can be found at %{url}." + details_html: 'More details about the changeset can be found at + %{url}.' message: inbox: title: "Inbox" @@ -2288,11 +2298,6 @@ en: against_oneway_without_exit: Go against one-way on %{name} end_oneway_without_exit: End of one-way on %{name} roundabout_with_exit: At roundabout take exit %{exit} onto %{name} - turn_left_with_exit: At roundabout turn left onto %{name} - slight_left_with_exit: At roundabout slight left onto %{name} - turn_right_with_exit: At roundabout turn right onto %{name} - slight_right_with_exit: At roundabout slight right onto %{name} - continue_with_exit: At roundabout continue straight onto %{name} unnamed: "unnamed road" courtesy: "Directions courtesy of %{link}" time: "Time" From 45e90cfd2416a6023f2e3f6b81f8f8bbb0261cbd Mon Sep 17 00:00:00 2001 From: Herve Saint-Amand Date: Thu, 29 Dec 2016 21:58:02 +0000 Subject: [PATCH 02/42] reverting erroneous deletion in previous commit --- config/locales/en.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/config/locales/en.yml b/config/locales/en.yml index 52994509fa..8cd04e3ce0 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -2298,6 +2298,11 @@ en: against_oneway_without_exit: Go against one-way on %{name} end_oneway_without_exit: End of one-way on %{name} roundabout_with_exit: At roundabout take exit %{exit} onto %{name} + turn_left_with_exit: At roundabout turn left onto %{name} + slight_left_with_exit: At roundabout slight left onto %{name} + turn_right_with_exit: At roundabout turn right onto %{name} + slight_right_with_exit: At roundabout slight right onto %{name} + continue_with_exit: At roundabout continue straight onto %{name} unnamed: "unnamed road" courtesy: "Directions courtesy of %{link}" time: "Time" From 689769cadad01bf6be271ecaf40a625c3edc7676 Mon Sep 17 00:00:00 2001 From: Herve Saint-Amand Date: Thu, 29 Dec 2016 23:37:22 +0000 Subject: [PATCH 03/42] avatar inline attachment --- app/models/notifier.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/app/models/notifier.rb b/app/models/notifier.rb index b53210c30e..ea10eeb7bd 100644 --- a/app/models/notifier.rb +++ b/app/models/notifier.rb @@ -179,12 +179,25 @@ def changeset_comment_notification(comment, recipient) content: @@osm_logo_png_bytes, } + File.open(user_avatar_file_path(comment.author), 'rb') do |file| + attachments.inline['avatar.png'] = file.read() + end + mail :to => recipient.email, :subject => subject end end private + def user_avatar_file_path(user) + image = user.image + if image.file? + return image.path.sub('/original/', '/small/') + else + return Rails.root.join('app', 'assets', 'images', 'users', 'images', 'small.png') + end + end + def with_recipient_locale(recipient) I18n.with_locale Locale.available.preferred(recipient.preferred_languages) do yield From 1f0f7ba621cadc01c802863135583b1d0feb1bf4 Mon Sep 17 00:00:00 2001 From: Herve Saint-Amand Date: Thu, 29 Dec 2016 23:37:39 +0000 Subject: [PATCH 04/42] avatar inline attachment; text alignment --- .../notifier/changeset_comment_notification.html.erb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/views/notifier/changeset_comment_notification.html.erb b/app/views/notifier/changeset_comment_notification.html.erb index dffb290593..3aaf9fb9e6 100644 --- a/app/views/notifier/changeset_comment_notification.html.erb +++ b/app/views/notifier/changeset_comment_notification.html.erb @@ -24,7 +24,7 @@ -
+

<% if @owner %> <%= t "notifier.changeset_comment_notification.commented.your_changeset_html", :commenter => @commenter, :commenter_url => @commenter_url, :time => @time %> @@ -37,12 +37,12 @@ <%= t "notifier.changeset_comment_notification.commented.partial_changeset_without_comment" %> <% end %>

- +
- - From 94062a17b3e2ee1984b7bc2b744945d5aa7bf2e9 Mon Sep 17 00:00:00 2001 From: Herve Saint-Amand Date: Fri, 30 Dec 2016 23:45:32 +0000 Subject: [PATCH 05/42] Cleaned up HTML Removed some cargo-cult HTML attributes and CSS. Styling HTML for email clients is trickier than for browsers, I'm trying to keep the code as succinct but also as compatible as possible. --- .../changeset_comment_notification.html.erb | 33 ++++++++++--------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/app/views/notifier/changeset_comment_notification.html.erb b/app/views/notifier/changeset_comment_notification.html.erb index 3aaf9fb9e6..752f6c0f43 100644 --- a/app/views/notifier/changeset_comment_notification.html.erb +++ b/app/views/notifier/changeset_comment_notification.html.erb @@ -3,18 +3,18 @@ - -
- + + <%= image_tag attachments["avatar.png"].url, alt: @commenter %> + <%= @comment.to_html %>
+ +
-
- +
+ - -
+ <%= image_tag attachments["osm_logo_30x30.png"].url, alt: "OpenStreetMap logo", title: "OpenStreetMap", height: "30", width: "30", border: "0" %> +

OpenStreetMap

@@ -22,10 +22,10 @@
- +
- @@ -59,10 +59,11 @@ - @@ -61,7 +61,7 @@
-

+

+

<% if @owner %> <%= t "notifier.changeset_comment_notification.commented.your_changeset_html", :commenter => @commenter, :commenter_url => @commenter_url, :time => @time %> <% else %> @@ -37,18 +37,18 @@ <%= t "notifier.changeset_comment_notification.commented.partial_changeset_without_comment" %> <% end %>

- +
- -
+ <%= image_tag attachments["avatar.png"].url, alt: @commenter %> + <%= @comment.to_html %>

-

<%= raw t 'notifier.changeset_comment_notification.details_html', :url => link_to(@changeset_url, @changeset_url) %>

+ <%= raw t 'notifier.changeset_comment_notification.details_html', :url => link_to(@changeset_url, @changeset_url) %>

+

- Unsubscribe - from updates to this changeset + To unsubscribe from updates to this changeset, visit + <%= @changeset_url %> + and click 'Unsubscribe'

OpenStreetMap.org From 5f663b765a85fe2e7a35493077df89268cb1aab3 Mon Sep 17 00:00:00 2001 From: Herve Saint-Amand Date: Sat, 31 Dec 2016 00:14:24 +0000 Subject: [PATCH 06/42] Tweaked cell padding Tweaked cell padding to align the top of the avatar and of the message text a bit better. --- app/views/notifier/changeset_comment_notification.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/notifier/changeset_comment_notification.html.erb b/app/views/notifier/changeset_comment_notification.html.erb index 752f6c0f43..8895f837a8 100644 --- a/app/views/notifier/changeset_comment_notification.html.erb +++ b/app/views/notifier/changeset_comment_notification.html.erb @@ -39,10 +39,10 @@

- - From b5ef2be021d84d8e05575d1569bacd3446d148db Mon Sep 17 00:00:00 2001 From: Herve Saint-Amand Date: Sun, 1 Jan 2017 22:11:56 +0000 Subject: [PATCH 07/42] Better loading of attached images Got rid of that big ugly base64 blob which was only a temporary crutch anyway. Added a png file instead. Use File.read rather than File.open for a 66% reduction in verbosity. --- app/assets/images/osm_logo_30.png | Bin 0 -> 2771 bytes app/models/notifier.rb | 66 +----------------- .../changeset_comment_notification.html.erb | 2 +- 3 files changed, 3 insertions(+), 65 deletions(-) create mode 100644 app/assets/images/osm_logo_30.png diff --git a/app/assets/images/osm_logo_30.png b/app/assets/images/osm_logo_30.png new file mode 100644 index 0000000000000000000000000000000000000000..c963f4f4a5bd97b3d6ceef0aa1b417926e8502c2 GIT binary patch literal 2771 zcmV;^3M}=BP)Px#AY({UO#lFTCIA3{ga82g0001h=l}q9FaQARU;qF* zm;eA5aGbhPJOBUy24YJ`L;(K){{a7>y{D4^000SaNLh0L02{9W02{9XUK)`c000Td zNklPl!!AT(l7rh*H*#nB6PM#@E;TYu{NL zEEit=gY{z)U|aOvHC=iGD{#E}t8X!+VybNu(kbK{c>H%@;1 z{_hXLW#tmbFR79Qv?(#_T;lsZNWE%A6svJQ<3lHlVGEvX# zaVroBf~3spWdm|of-0N&8m%y$Jn2@66n-nd_`bl(DwC<oL^FCq>27~5s`_loFt%DqS zVi&b)Bu1z>@5o)r6jSv2yIH*T8Og>Hd-t^u4~;ac=^#r0%(3=&*~cW_>lszeRY9F1 zNrCU=q-mc#PpL@2P*g*G$spxx&uqUzCRK+y`&PLA*AcyV|f)hJ>lYOs90&;DJ< zn3)+v0wo9o#0sT2N+~fRM75BxVn~x7m4-#)_UzyN%?C#>UmE-;7?9ptu~iA`TX9gs znwTK25RBB&)KQc<&KHy}V{5HP&CD`AGft^FsvZSG6ViwpG{PpWXoyDC01LI21uYmE zYgOjv7k=-D-~Xe=fkRIb0H~_w(dzMPrT&93h+``eaabb^Vq&e}DoUECY$Y8&yS~ZJ z*(aHv7@-oz*uWwpM5c@om89g@UA_3j(+ENf9D+=#g>cfZ?{C`S+CoDcj{183B*vOiS&G*fo4*sF%iRp z)JW1uj0i>q5fD)#Ys7ga%aA;+650tV!@HC?u~C3lghsQm>-hX0tl|OYRAn!0lf63d z9y*S$O;~Z8sIM|in@*rO9L_5QinS%)1(eQ^79~mH$xBb+6l)bw1c3mImH%*+^?20# zLn1PPY+ou4))UIul12_qU??1;GLq0)Qu18LjHhZ-h&reXNcuJUNrWno$~bJ4km>e! zq9DWuF@s+J?p^P&SOWYK#$A6snPzY7ps;#Pic?Qe=@I%N&C`acqH(1wQB?N;;{3k-u@TuRfBwo}ucf{0vN49h257&)Wd$-; zB_Kq!g7X$@4V7x0GjINaD<6M|P({^j&rm_t6WAVM+$XXTt$2vxaENM9m}G^r3|GsML%YRxu7Lu0)D>W{g8`6}w` zkBp&@`~iZ{uytD02ne}+{U+x>`QVq=uUbVyWPt5FWe*+9uCdO>>IBoH!8KT zw2vaw{l$;}xL=DJ&Z88i!Mhr^9Uy*<({Eknji3GsO&y08EXR%x)7X2I@hL;MGoWON ze!5A%3Sl)SsX3BhKy#>qWHDJW#K?Fx$cr@Ub_S^gmBK!A{0Y|in6JL@<^56AY-fcb zu4YJ(k{4T?{+ElK{-^Uu;c?FK?k7E-ec?HNZ8g3e$-XRAvtIl8$;r^xA( z(Y0NMhw4lXwOC&XuATVXH}2P)aoX*4o&C{Y{)nIb^DoU)&pq{(+_|vJGD9{-OV67> z`bx_}(01tZ54EJu{=7qW5%Rx&+2h=5YF_A93>4574~CJIA2N+5OlgFMaa} zkI#=`+9}=M6hU)9Tx8gRFl4I~Qz08gf=vymBETRY^zSTR`T*Fvdvj3%Y<&t=uRq)w z_+)3@)`-iHlPAvb`ahmQvu$YVOZGmogO^`C#KPm#1l0y=0$QUFNs=+B^@&?4P7Eu( zH8y%3L=|HV7@W8_lcjtkjUT47Tul-6-op@I$oI2+uSEmP$ z&CAQ*dWQL_QKCUeG1kyZWgs^21U9GNY2%%tQtfG4B;veNYXiXuMhs={?%p_mXL(i6 zFfPw;gJG6#XHdhKJ2%cQj-NVlX1GXl)O+y(JpGje^3u1CGCeoqi>%zdcYWo`^$Qn1 znVK1znA54N4@3i*U zrIm*ptHwxt@W^Ac&wu^s!9&k1JUux*|75*oC%T;n>x;|xZ{7Or-nCno?p?X`?u~1A zuPxsMRsi?wU;q=>Mw>5w?eOzI_|4Xzoc!0D3#UGE7md-g&gGXk*ETM0ZEV~IIzR^7 zOMJUyRDkCEzFqCd4(uAab^TUn@#^R6&iO8o0Qn=J@@taa3y(40-buf=5j$rNOpN%K zqfllaY?wt5LmvPD literal 0 HcmV?d00001 diff --git a/app/models/notifier.rb b/app/models/notifier.rb index ea10eeb7bd..bfcdc499e3 100644 --- a/app/models/notifier.rb +++ b/app/models/notifier.rb @@ -173,15 +173,8 @@ def changeset_comment_notification(comment, recipient) I18n.t("notifier.changeset_comment_notification.commented.subject_other", :commenter => @commenter) end - attachments.inline['osm_logo_30x30.png'] = { - mime_type: 'image/png', - encoding: 'base64', - content: @@osm_logo_png_bytes, - } - - File.open(user_avatar_file_path(comment.author), 'rb') do |file| - attachments.inline['avatar.png'] = file.read() - end + attachments.inline['logo.png'] = File.read(Rails.root.join('app', 'assets', 'images', 'osm_logo_30.png')) + attachments.inline['avatar.png'] = File.read(user_avatar_file_path(comment.author)) mail :to => recipient.email, :subject => subject end @@ -216,59 +209,4 @@ def from_address(name, type, id, digest, user_id = nil) end end - # FIXME - 2016-12-28 - saintamh - someone please show me a better way to - # include this blob in here. If I save it under app/assets, how do I get a - # path to it in a portable way? - @@osm_logo_png_bytes = < From 20a74fcbf16d2da4ce8c758abf7af857367f2649 Mon Sep 17 00:00:00 2001 From: Herve Saint-Amand Date: Sun, 1 Jan 2017 22:39:07 +0000 Subject: [PATCH 11/42] Remove unused variable --- app/models/notifier.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/app/models/notifier.rb b/app/models/notifier.rb index 40f1875be5..69c447877e 100644 --- a/app/models/notifier.rb +++ b/app/models/notifier.rb @@ -160,7 +160,6 @@ def changeset_comment_notification(comment, recipient) @owner = recipient == comment.changeset.user @commenter = comment.author.display_name @commenter_url = user_url(comment.author.display_name, :host => SERVER_URL) - @commenter_thumbnail_src = comment.author.image.url(:small, :host => SERVER_URL) @changeset_comment = comment.changeset.tags["comment"].presence @time = comment.created_at @changeset_author = comment.changeset.user.display_name From 7a4e13ecad1017a526950c60bfe674d4277632e7 Mon Sep 17 00:00:00 2001 From: Herve Saint-Amand Date: Sun, 1 Jan 2017 23:39:42 +0000 Subject: [PATCH 12/42] Fixed quotes Replaced single quotes with double quotes, to comply with rubocop rules. --- app/models/notifier.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/models/notifier.rb b/app/models/notifier.rb index 69c447877e..873cfafc41 100644 --- a/app/models/notifier.rb +++ b/app/models/notifier.rb @@ -170,8 +170,8 @@ def changeset_comment_notification(comment, recipient) I18n.t("notifier.changeset_comment_notification.commented.subject_other", :commenter => @commenter) end - attachments.inline['logo.png'] = File.read(Rails.root.join('app', 'assets', 'images', 'osm_logo_30.png')) - attachments.inline['avatar.png'] = File.read(user_avatar_file_path(comment.author)) + attachments.inline["logo.png"] = File.read(Rails.root.join("app", "assets", "images", "osm_logo_30.png")) + attachments.inline["avatar.png"] = File.read(user_avatar_file_path(comment.author)) mail :to => recipient.email, :subject => subject end @@ -182,9 +182,9 @@ def changeset_comment_notification(comment, recipient) def user_avatar_file_path(user) image = user.image if image.file? - return image.path.sub('/original/', '/small/') + return image.path.sub("/original/", "/small/") else - return Rails.root.join('app', 'assets', 'images', 'users', 'images', 'small.png') + return Rails.root.join("app", "assets", "images", "users", "images", "small.png") end end From ab9aaf7e97b60d3dd8bbbd9867953637c05c0083 Mon Sep 17 00:00:00 2001 From: Herve Saint-Amand Date: Mon, 2 Jan 2017 21:35:59 +0000 Subject: [PATCH 13/42] Proper way to get path to small avatar Rather than performing perilous string substitution on paths, just use the built-in way to select the small version of the avatar image file. --- app/models/notifier.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/notifier.rb b/app/models/notifier.rb index 873cfafc41..40a516a927 100644 --- a/app/models/notifier.rb +++ b/app/models/notifier.rb @@ -182,7 +182,7 @@ def changeset_comment_notification(comment, recipient) def user_avatar_file_path(user) image = user.image if image.file? - return image.path.sub("/original/", "/small/") + return image.path(:small) else return Rails.root.join("app", "assets", "images", "users", "images", "small.png") end From beaa85e21cc2f647d6b9b8377a3b8192b54c9201 Mon Sep 17 00:00:00 2001 From: Herve Saint-Amand Date: Mon, 2 Jan 2017 23:48:49 +0000 Subject: [PATCH 14/42] More compact image paths Make the file paths to image assets more compact. I investigated using `image_path` but could only get it to return the path for a public URL, which is different and also includes the asset pipeline digest. --- app/models/notifier.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/notifier.rb b/app/models/notifier.rb index 40a516a927..d01ef07d14 100644 --- a/app/models/notifier.rb +++ b/app/models/notifier.rb @@ -170,7 +170,7 @@ def changeset_comment_notification(comment, recipient) I18n.t("notifier.changeset_comment_notification.commented.subject_other", :commenter => @commenter) end - attachments.inline["logo.png"] = File.read(Rails.root.join("app", "assets", "images", "osm_logo_30.png")) + attachments.inline["logo.png"] = File.read("#{Rails.root}/app/assets/images/osm_logo_30.png") attachments.inline["avatar.png"] = File.read(user_avatar_file_path(comment.author)) mail :to => recipient.email, :subject => subject @@ -184,7 +184,7 @@ def user_avatar_file_path(user) if image.file? return image.path(:small) else - return Rails.root.join("app", "assets", "images", "users", "images", "small.png") + return "#{Rails.root}/app/assets/images/users/images/small.png" end end From ac081305f24453b576d826f0b85a851e0e8506e2 Mon Sep 17 00:00:00 2001 From: Herve Saint-Amand Date: Tue, 3 Jan 2017 22:38:58 +0000 Subject: [PATCH 15/42] Remove HTML markup from locale file Rather than including HTML markup in the locale file (which also has the inconvenience of requiring both a plain-text and an HTML duplicate of the same string), move the markup to the template. Also added a helper to reduce clutter in the template slightly. --- app/helpers/notifier_helper.rb | 9 +++++++++ app/models/notifier.rb | 1 - .../changeset_comment_notification.html.erb | 10 +++++----- config/locales/en.yml | 14 +------------- 4 files changed, 15 insertions(+), 19 deletions(-) diff --git a/app/helpers/notifier_helper.rb b/app/helpers/notifier_helper.rb index 4b2cd2a06d..62801ed823 100644 --- a/app/helpers/notifier_helper.rb +++ b/app/helpers/notifier_helper.rb @@ -2,4 +2,13 @@ module NotifierHelper def fp(text) format_paragraph(text, 72, 0) end + + def link_to_user(display_name) + link_to( + display_name, + user_url(display_name, :host => SERVER_URL), + :target => "_blank", + :style => "text-decoration: none; color: #222; font-weight: bold" + ) + end end diff --git a/app/models/notifier.rb b/app/models/notifier.rb index d01ef07d14..60b682693f 100644 --- a/app/models/notifier.rb +++ b/app/models/notifier.rb @@ -159,7 +159,6 @@ def changeset_comment_notification(comment, recipient) @comment = comment.body @owner = recipient == comment.changeset.user @commenter = comment.author.display_name - @commenter_url = user_url(comment.author.display_name, :host => SERVER_URL) @changeset_comment = comment.changeset.tags["comment"].presence @time = comment.created_at @changeset_author = comment.changeset.user.display_name diff --git a/app/views/notifier/changeset_comment_notification.html.erb b/app/views/notifier/changeset_comment_notification.html.erb index 67deff5e03..6bb1b68115 100644 --- a/app/views/notifier/changeset_comment_notification.html.erb +++ b/app/views/notifier/changeset_comment_notification.html.erb @@ -27,12 +27,12 @@
+ <%= image_tag attachments["avatar.png"].url, alt: @commenter %> + <%= @comment.to_html %>
- <%= image_tag attachments["osm_logo_30x30.png"].url, alt: "OpenStreetMap logo", title: "OpenStreetMap", height: "30", width: "30", border: "0" %> + <%= image_tag attachments["logo.png"].url, alt: "OpenStreetMap logo", title: "OpenStreetMap", height: "30", width: "30", border: "0" %> From 20bd72d9e9a8efd50856d91cf48a57926b9a13f5 Mon Sep 17 00:00:00 2001 From: Herve Saint-Amand Date: Sun, 1 Jan 2017 22:30:41 +0000 Subject: [PATCH 08/42] Move localised text to locale file Moved a string of English text that will require translation from the HTML template to the locale I18N file. --- app/views/notifier/changeset_comment_notification.html.erb | 4 +--- config/locales/en.yml | 3 +++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/views/notifier/changeset_comment_notification.html.erb b/app/views/notifier/changeset_comment_notification.html.erb index d7bedad637..03658852a2 100644 --- a/app/views/notifier/changeset_comment_notification.html.erb +++ b/app/views/notifier/changeset_comment_notification.html.erb @@ -61,9 +61,7 @@

- To unsubscribe from updates to this changeset, visit - <%= @changeset_url %> - and click 'Unsubscribe' + <%= t 'notifier.changeset_comment_notification.unsubscribe_html', :url => @changeset_url %>

OpenStreetMap.org diff --git a/config/locales/en.yml b/config/locales/en.yml index 8cd04e3ce0..7a255cd4b5 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1329,6 +1329,9 @@ en: details: "More details about the changeset can be found at %{url}." details_html: 'More details about the changeset can be found at %{url}.' + unsubscribe_html: 'To unsubscribe from updates to this changeset, + visit %{url} + and click "Unsubscribe".' message: inbox: title: "Inbox" From 1d86379a5c55d1007f002ca0505b69d43a37def6 Mon Sep 17 00:00:00 2001 From: Herve Saint-Amand Date: Sun, 1 Jan 2017 22:33:22 +0000 Subject: [PATCH 09/42] Remove unused import --- app/models/notifier.rb | 3 --- 1 file changed, 3 deletions(-) diff --git a/app/models/notifier.rb b/app/models/notifier.rb index bfcdc499e3..40f1875be5 100644 --- a/app/models/notifier.rb +++ b/app/models/notifier.rb @@ -1,5 +1,3 @@ -require "base64" - class Notifier < ActionMailer::Base default :from => EMAIL_FROM, :return_path => EMAIL_RETURN_PATH, @@ -208,5 +206,4 @@ def from_address(name, type, id, digest, user_id = nil) EMAIL_FROM end end - end From b5fd9f5fbe32f65a28e128deb1909d7c31237e85 Mon Sep 17 00:00:00 2001 From: Herve Saint-Amand Date: Sun, 1 Jan 2017 22:35:59 +0000 Subject: [PATCH 10/42] Use parameterised server root URL rather than hardcoded --- app/views/notifier/changeset_comment_notification.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/notifier/changeset_comment_notification.html.erb b/app/views/notifier/changeset_comment_notification.html.erb index 03658852a2..67deff5e03 100644 --- a/app/views/notifier/changeset_comment_notification.html.erb +++ b/app/views/notifier/changeset_comment_notification.html.erb @@ -64,7 +64,7 @@ <%= t 'notifier.changeset_comment_notification.unsubscribe_html', :url => @changeset_url %>

- OpenStreetMap.org + OpenStreetMap

<% if @owner %> - <%= t "notifier.changeset_comment_notification.commented.your_changeset_html", :commenter => @commenter, :commenter_url => @commenter_url, :time => @time %> + <%= raw t "notifier.changeset_comment_notification.commented.your_changeset", :commenter => link_to_user(@commenter), :time => @time %> <% else %> - <%= t "notifier.changeset_comment_notification.commented.commented_changeset_html", :commenter => @commenter, :commenter_url => @commenter_url, :time => @time, :changeset_author => @changeset_author %> + <%= raw t "notifier.changeset_comment_notification.commented.commented_changeset", :commenter => link_to_user(@commenter), :time => @time, :changeset_author => @changeset_author %> <% end %> <% if @changeset_comment %> - <%= t "notifier.changeset_comment_notification.commented.partial_changeset_with_comment_html", :changeset_comment => @changeset_comment %> + <%= raw t "notifier.changeset_comment_notification.commented.partial_changeset_with_comment", :changeset_comment => content_tag("em", @changeset_comment) %> <% else %> <%= t "notifier.changeset_comment_notification.commented.partial_changeset_without_comment" %> <% end %> @@ -48,7 +48,7 @@

- <%= raw t 'notifier.changeset_comment_notification.details_html', :url => link_to(@changeset_url, @changeset_url) %> + <%= raw t 'notifier.changeset_comment_notification.details', :url => content_tag("nobr", link_to(@changeset_url, @changeset_url)) %>

- <%= t 'notifier.changeset_comment_notification.unsubscribe_html', :url => @changeset_url %> + <%= raw t 'notifier.changeset_comment_notification.unsubscribe', :url => content_tag("nobr", link_to(@changeset_url, @changeset_url, :style => "color: #222")) %>

OpenStreetMap diff --git a/config/locales/en.yml b/config/locales/en.yml index 7a255cd4b5..ab50a681ad 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1315,23 +1315,11 @@ en: subject_own: "[OpenStreetMap] %{commenter} has commented on one of your changesets" subject_other: "[OpenStreetMap] %{commenter} has commented on a changeset you are interested in" your_changeset: "%{commenter} has left a comment on one of your changesets created at %{time}" - your_changeset_html: '%{commenter} - has left a comment on one of your changesets - created at %{time}' commented_changeset: "%{commenter} has left a comment on a map changeset you are watching created by %{changeset_author} at %{time}" - commented_changeset_html: '%{commenter} - has left a comment on a map changeset you are watching created by - %{changeset_author} - at %{time}' partial_changeset_with_comment: "with comment '%{changeset_comment}'" - partial_changeset_with_comment_html: 'with comment %{changeset_comment}' partial_changeset_without_comment: "without comment" details: "More details about the changeset can be found at %{url}." - details_html: 'More details about the changeset can be found at - %{url}.' - unsubscribe_html: 'To unsubscribe from updates to this changeset, - visit %{url} - and click "Unsubscribe".' + unsubscribe: 'To unsubscribe from updates to this changeset, visit %{url} and click "Unsubscribe".' message: inbox: title: "Inbox" From 479a4bd0d7f9e3ece258634475fdc47f863c5c19 Mon Sep 17 00:00:00 2001 From: Herve Saint-Amand Date: Fri, 6 Jan 2017 22:37:28 +0000 Subject: [PATCH 16/42] First steps towards using layouts Since all HTML mails will presumably share the same overall layout, and the markup is fairly dense, it makes sense to use Rails layouts to share the structure across mail templates. This commit moves the core structure of the HTML mail to a layout. It will need to be further refined so that notifications that involve a text message sent by another user can share the avatar-and-message-text structure. --- app/views/layouts/notifier.html.erb | 47 ++++++++ .../changeset_comment_notification.html.erb | 106 ++++++------------ 2 files changed, 80 insertions(+), 73 deletions(-) create mode 100644 app/views/layouts/notifier.html.erb diff --git a/app/views/layouts/notifier.html.erb b/app/views/layouts/notifier.html.erb new file mode 100644 index 0000000000..fb001d7c15 --- /dev/null +++ b/app/views/layouts/notifier.html.erb @@ -0,0 +1,47 @@ + + + + + + + + + + + + + +
+ + + + + + + + +
+ + <%= image_tag attachments["logo.png"].url, alt: "OpenStreetMap logo", title: "OpenStreetMap", height: "30", width: "30", border: "0" %> + + + +

OpenStreetMap

+
+
+ + + + +
+ <%= yield :body %> +
+
+
+ <%= yield :footer %> +

+ OpenStreetMap +

+
+ + diff --git a/app/views/notifier/changeset_comment_notification.html.erb b/app/views/notifier/changeset_comment_notification.html.erb index 6bb1b68115..344a4e33d6 100644 --- a/app/views/notifier/changeset_comment_notification.html.erb +++ b/app/views/notifier/changeset_comment_notification.html.erb @@ -1,73 +1,33 @@ - - - - - - - - - - - - - -
- - - - - - - - -
- - <%= image_tag attachments["logo.png"].url, alt: "OpenStreetMap logo", title: "OpenStreetMap", height: "30", width: "30", border: "0" %> - - - -

OpenStreetMap

-
-
- - - - -
-

- <% if @owner %> - <%= raw t "notifier.changeset_comment_notification.commented.your_changeset", :commenter => link_to_user(@commenter), :time => @time %> - <% else %> - <%= raw t "notifier.changeset_comment_notification.commented.commented_changeset", :commenter => link_to_user(@commenter), :time => @time, :changeset_author => @changeset_author %> - <% end %> - <% if @changeset_comment %> - <%= raw t "notifier.changeset_comment_notification.commented.partial_changeset_with_comment", :changeset_comment => content_tag("em", @changeset_comment) %> - <% else %> - <%= t "notifier.changeset_comment_notification.commented.partial_changeset_without_comment" %> - <% end %> -

- - - - - -
- <%= image_tag attachments["avatar.png"].url, alt: @commenter %> - - <%= @comment.to_html %> -
-

- <%= raw t 'notifier.changeset_comment_notification.details', :url => content_tag("nobr", link_to(@changeset_url, @changeset_url)) %> -

-
-
-
-

- <%= raw t 'notifier.changeset_comment_notification.unsubscribe', :url => content_tag("nobr", link_to(@changeset_url, @changeset_url, :style => "color: #222")) %> -

-

- OpenStreetMap -

-
- - +<% content_for :body do %> +

+ <% if @owner %> + <%= raw t "notifier.changeset_comment_notification.commented.your_changeset", :commenter => link_to_user(@commenter), :time => @time %> + <% else %> + <%= raw t "notifier.changeset_comment_notification.commented.commented_changeset", :commenter => link_to_user(@commenter), :time => @time, :changeset_author => @changeset_author %> + <% end %> + <% if @changeset_comment %> + <%= raw t "notifier.changeset_comment_notification.commented.partial_changeset_with_comment", :changeset_comment => content_tag("em", @changeset_comment) %> + <% else %> + <%= t "notifier.changeset_comment_notification.commented.partial_changeset_without_comment" %> + <% end %> +

+ + + + + +
+ <%= image_tag attachments["avatar.png"].url, alt: @commenter %> + + <%= @comment.to_html %> +
+

+ <%= raw t 'notifier.changeset_comment_notification.details', :url => content_tag("nobr", link_to(@changeset_url, @changeset_url)) %> +

+<% end %> + +<% content_for :footer do %> +

+ <%= raw t 'notifier.changeset_comment_notification.unsubscribe', :url => content_tag("nobr", link_to(@changeset_url, @changeset_url, :style => "color: #222")) %> +

+<% end %> From 417176f8685ae60b670e609ca4d7e2e7c5c07647 Mon Sep 17 00:00:00 2001 From: Herve Saint-Amand Date: Sun, 8 Jan 2017 22:09:10 +0000 Subject: [PATCH 17/42] Moved message table HTMl to a partial template Several notifications are about a message having been sent from one user to another via OSM. I've moved the code for the HTML table that holds the actual user message, with the avatar and the body text, to its own partial template, so that it can be reused. I've updated a second notifier message to the new template, diary_comment_notification. --- app/models/notifier.rb | 23 ++++++++++++++--- .../notifier/_user_message_table.html.erb | 18 +++++++++++++ .../changeset_comment_notification.html.erb | 15 ++++------- .../diary_comment_notification.html.erb | 25 +++++++++++++------ 4 files changed, 61 insertions(+), 20 deletions(-) create mode 100644 app/views/notifier/_user_message_table.html.erb diff --git a/app/models/notifier.rb b/app/models/notifier.rb index 60b682693f..ee40a0d6ef 100644 --- a/app/models/notifier.rb +++ b/app/models/notifier.rb @@ -3,6 +3,7 @@ class Notifier < ActionMailer::Base :return_path => EMAIL_RETURN_PATH, :auto_submitted => "auto-generated" helper :application + before_action :set_shared_template_vars def signup_confirm(user, token) with_recipient_locale user do @@ -106,6 +107,9 @@ def diary_comment_notification(comment, recipient) :action => "new", :display_name => comment.user.display_name, :title => "Re: #{comment.diary_entry.title}") + @user_message_author = @from_user + + attach_user_avatar(comment.user) mail :from => from_address(comment.user.display_name, "c", comment.id, comment.digest, recipient.id), :to => recipient.email, @@ -154,7 +158,6 @@ def note_comment_notification(comment, recipient) def changeset_comment_notification(comment, recipient) with_recipient_locale recipient do - @root_url = root_url(:host => SERVER_URL) @changeset_url = changeset_url(comment.changeset, :host => SERVER_URL) @comment = comment.body @owner = recipient == comment.changeset.user @@ -162,6 +165,7 @@ def changeset_comment_notification(comment, recipient) @changeset_comment = comment.changeset.tags["comment"].presence @time = comment.created_at @changeset_author = comment.changeset.user.display_name + @user_message_author = @commenter subject = if @owner I18n.t("notifier.changeset_comment_notification.commented.subject_own", :commenter => @commenter) @@ -169,8 +173,8 @@ def changeset_comment_notification(comment, recipient) I18n.t("notifier.changeset_comment_notification.commented.subject_other", :commenter => @commenter) end - attachments.inline["logo.png"] = File.read("#{Rails.root}/app/assets/images/osm_logo_30.png") - attachments.inline["avatar.png"] = File.read(user_avatar_file_path(comment.author)) + attach_project_logo + attach_user_avatar(comment.author) mail :to => recipient.email, :subject => subject end @@ -178,6 +182,19 @@ def changeset_comment_notification(comment, recipient) private + def set_shared_template_vars + @root_url = root_url(:host => SERVER_URL) + attach_project_logo + end + + def attach_project_logo + attachments.inline["logo.png"] = File.read("#{Rails.root}/app/assets/images/osm_logo_30.png") + end + + def attach_user_avatar(user) + attachments.inline["avatar.png"] = File.read(user_avatar_file_path(user)) + end + def user_avatar_file_path(user) image = user.image if image.file? diff --git a/app/views/notifier/_user_message_table.html.erb b/app/views/notifier/_user_message_table.html.erb new file mode 100644 index 0000000000..0a73001734 --- /dev/null +++ b/app/views/notifier/_user_message_table.html.erb @@ -0,0 +1,18 @@ + + + + + +
+ <%= link_to( + image_tag( + attachments["avatar.png"].url, + alt: @user_message_author, + title: @user_message_author + ), + user_url(@user_message_author, :host => SERVER_URL), + :target => "_blank" + ) %> + + <%= captured %> +
diff --git a/app/views/notifier/changeset_comment_notification.html.erb b/app/views/notifier/changeset_comment_notification.html.erb index 344a4e33d6..4e271cfb2b 100644 --- a/app/views/notifier/changeset_comment_notification.html.erb +++ b/app/views/notifier/changeset_comment_notification.html.erb @@ -11,16 +11,11 @@ <%= t "notifier.changeset_comment_notification.commented.partial_changeset_without_comment" %> <% end %>

- - - - - -
- <%= image_tag attachments["avatar.png"].url, alt: @commenter %> - - <%= @comment.to_html %> -
+ + <%= render "notifier/user_message_table", :captured => capture { %> + <%= @comment.to_html %> + <% } %> +

<%= raw t 'notifier.changeset_comment_notification.details', :url => content_tag("nobr", link_to(@changeset_url, @changeset_url)) %>

diff --git a/app/views/notifier/diary_comment_notification.html.erb b/app/views/notifier/diary_comment_notification.html.erb index b47900a631..ea9a655910 100644 --- a/app/views/notifier/diary_comment_notification.html.erb +++ b/app/views/notifier/diary_comment_notification.html.erb @@ -1,9 +1,20 @@ -

<%= t'notifier.diary_comment_notification.hi', :to_user => @to_user %>

+<% content_for :body do %> +

+ <%= t'notifier.diary_comment_notification.hi', :to_user => @to_user %> +

+

+ <%= raw t'notifier.diary_comment_notification.header', :from_user => link_to_user(@from_user), :subject => content_tag("em", @title) %> +

-

<%= raw t'notifier.diary_comment_notification.header', :from_user => link_to(@from_user, :host => SERVER_URL, :controller => :user, :action => :view, :display_name => @from_user), :subject => @title %>

+ <%= render "notifier/user_message_table", :captured => capture { %> + <%= @text.to_html %> + <% } %> +<% end %> -== -<%= @text.to_html %> -== - -

<%= raw t'notifier.diary_comment_notification.footer', :readurl => link_to(@readurl, @readurl), :commenturl => link_to(@commenturl, @commenturl), :replyurl => link_to(@replyurl, @replyurl) %>

+<% content_for :footer do %> +

<%= raw t'notifier.diary_comment_notification.footer', + :readurl => link_to(@readurl, @readurl) + tag(:br), + :commenturl => link_to(@commenturl, @commenturl) + tag(:br), + :replyurl => link_to(@replyurl, @replyurl) + %>

+<% end %> From 3aa69ffbdda5f111aed60d77e1a1eec8cdcad3ba Mon Sep 17 00:00:00 2001 From: Herve Saint-Amand Date: Mon, 9 Jan 2017 23:42:43 +0000 Subject: [PATCH 18/42] Dressed up a few more messages. email_confirm, message_notification and signup_confirm now use the new templates. This fixes some, but not all, of the currently broken tests. --- app/models/notifier.rb | 3 ++ app/views/notifier/email_confirm.html.erb | 10 ++++--- .../notifier/message_notification.html.erb | 29 ++++++++++++++----- app/views/notifier/signup_confirm.html.erb | 12 ++++---- 4 files changed, 38 insertions(+), 16 deletions(-) diff --git a/app/models/notifier.rb b/app/models/notifier.rb index ee40a0d6ef..8f34866266 100644 --- a/app/models/notifier.rb +++ b/app/models/notifier.rb @@ -77,6 +77,9 @@ def message_notification(message) @replyurl = url_for(:host => SERVER_URL, :controller => "message", :action => "reply", :message_id => message.id) + @user_message_author = @from_user + + attach_user_avatar(message.sender) mail :from => from_address(message.sender.display_name, "m", message.id, message.digest), :to => message.recipient.email, diff --git a/app/views/notifier/email_confirm.html.erb b/app/views/notifier/email_confirm.html.erb index 5b7c74d7f5..5c639d57fd 100644 --- a/app/views/notifier/email_confirm.html.erb +++ b/app/views/notifier/email_confirm.html.erb @@ -1,7 +1,9 @@ -

<%= t 'notifier.email_confirm_html.greeting' %>

+<% content_for :body do %> +

<%= t 'notifier.email_confirm_html.greeting' %>

-

<%= t 'notifier.email_confirm_html.hopefully_you', :server_url => SERVER_URL, :new_address => @address %>

+

<%= t 'notifier.email_confirm_html.hopefully_you', :server_url => SERVER_URL, :new_address => @address %>

-

<%= t 'notifier.email_confirm_html.click_the_link' %>

+

<%= t 'notifier.email_confirm_html.click_the_link' %>

-

<%= @url %>

+

<%= @url %>

+<% end %> diff --git a/app/views/notifier/message_notification.html.erb b/app/views/notifier/message_notification.html.erb index 19704251d8..823f1487aa 100644 --- a/app/views/notifier/message_notification.html.erb +++ b/app/views/notifier/message_notification.html.erb @@ -1,9 +1,24 @@ -

<%= t'notifier.message_notification.hi', :to_user => @to_user %>

+<% content_for :body do %> +

+ <%= t'notifier.message_notification.hi', :to_user => @to_user %> +

+

+ <%= raw t'notifier.message_notification.header', + :from_user => link_to_user(@from_user), + :subject => content_tag("em", @title) + %> +

-

<%= raw t'notifier.message_notification.header', :from_user => link_to(@from_user, :host => SERVER_URL, :controller => :user, :action => :view, :display_name => @from_user), :subject => @title %>

+ <%= render "notifier/user_message_table", :captured => capture { %> + <%= @text.to_html %> + <% } %> +<% end %> -== -<%= @text.to_html %> -== - -

<%= t'notifier.message_notification.footer_html', :readurl => link_to(@readurl, @readurl), :replyurl => link_to(@replyurl, @replyurl) %>

+<% content_for :footer do %> +

+ <%= t'notifier.message_notification.footer_html', + :readurl => link_to(@readurl, @readurl) + tag(:br), + :replyurl => link_to(@replyurl, @replyurl) + %> +

+<% end %> diff --git a/app/views/notifier/signup_confirm.html.erb b/app/views/notifier/signup_confirm.html.erb index 814deee917..66528bd834 100644 --- a/app/views/notifier/signup_confirm.html.erb +++ b/app/views/notifier/signup_confirm.html.erb @@ -1,9 +1,11 @@ -

<%= t("notifier.signup_confirm.greeting") %>

+<% content_for :body do %> +

<%= t("notifier.signup_confirm.greeting") %>

-

<%= t("notifier.signup_confirm.created", :site_url => SERVER_URL) %>

+

<%= t("notifier.signup_confirm.created", :site_url => SERVER_URL) %>

-

<%= t("notifier.signup_confirm.confirm") %>

+

<%= t("notifier.signup_confirm.confirm") %>

-

<%= link_to @url, @url %>

+

<%= link_to @url, @url, :style => "white-space: nowrap" %>

-

<%= t("notifier.signup_confirm.welcome") %>

+

<%= t("notifier.signup_confirm.welcome") %>

+<% end %> From 31778fd1554d0c23298c92fb62c2277200e31e61 Mon Sep 17 00:00:00 2001 From: Herve Saint-Amand Date: Wed, 11 Jan 2017 22:03:00 +0000 Subject: [PATCH 19/42] Removed unbalanced tag HTML tag --- app/views/notifier/signup_confirm.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/notifier/signup_confirm.html.erb b/app/views/notifier/signup_confirm.html.erb index 66528bd834..6e7f7280e2 100644 --- a/app/views/notifier/signup_confirm.html.erb +++ b/app/views/notifier/signup_confirm.html.erb @@ -5,7 +5,7 @@

<%= t("notifier.signup_confirm.confirm") %>

-

<%= link_to @url, @url, :style => "white-space: nowrap" %>

+

<%= link_to @url, @url, :style => "white-space: nowrap" %>

<%= t("notifier.signup_confirm.welcome") %>

<% end %> From 0449024ca0f53307615993e9a480a28355153bc7 Mon Sep 17 00:00:00 2001 From: Herve Saint-Amand Date: Wed, 11 Jan 2017 23:17:24 +0000 Subject: [PATCH 20/42] Modify tests to search only text parts The tests assumed that every part in the multipart emails that we send were either plain text or HTML. Now we have image attachments, against whose contents the tests were still trying to match regexes. The tests have been modified to only run regexes on the text parts of the mails. --- test/integration/user_creation_test.rb | 28 +++++++++++++------------- test/test_helper.rb | 12 +++++++++++ 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/test/integration/user_creation_test.rb b/test/integration/user_creation_test.rb index db35be5f35..09d2cc1fde 100644 --- a/test/integration/user_creation_test.rb +++ b/test/integration/user_creation_test.rb @@ -135,10 +135,10 @@ def test_user_create_redirect assert_equal register_email.to[0], new_email # Check that the confirm account url is correct confirm_regex = Regexp.new("/user/redirect_tester/confirm\\?confirm_string=([a-zA-Z0-9]*)") - register_email.parts.each do |part| + email_text_parts(register_email).each do |part| assert_match confirm_regex, part.body.to_s end - confirm_string = register_email.parts[0].body.match(confirm_regex)[1] + confirm_string = email_text_parts(register_email)[0].body.match(confirm_regex)[1] # Check the page assert_response :success @@ -248,10 +248,10 @@ def test_user_create_openid_redirect assert_equal register_email.to[0], new_email # Check that the confirm account url is correct confirm_regex = Regexp.new("/user/redirect_tester_openid/confirm\\?confirm_string=([a-zA-Z0-9]*)") - register_email.parts.each do |part| + email_text_parts(register_email).each do |part| assert_match confirm_regex, part.body.to_s end - confirm_string = register_email.parts[0].body.match(confirm_regex)[1] + confirm_string = email_text_parts(register_email)[0].body.match(confirm_regex)[1] # Check the page assert_response :success @@ -365,10 +365,10 @@ def test_user_create_google_redirect assert_equal register_email.to[0], new_email # Check that the confirm account url is correct confirm_regex = Regexp.new("/user/redirect_tester_google/confirm\\?confirm_string=([a-zA-Z0-9]*)") - register_email.parts.each do |part| + email_text_parts(register_email).each do |part| assert_match confirm_regex, part.body.to_s end - confirm_string = register_email.parts[0].body.match(confirm_regex)[1] + confirm_string = email_text_parts(register_email)[0].body.match(confirm_regex)[1] # Check the page assert_response :success @@ -478,10 +478,10 @@ def test_user_create_facebook_redirect assert_equal register_email.to[0], new_email # Check that the confirm account url is correct confirm_regex = Regexp.new("/user/redirect_tester_facebook/confirm\\?confirm_string=([a-zA-Z0-9]*)") - register_email.parts.each do |part| + email_text_parts(register_email).each do |part| assert_match confirm_regex, part.body.to_s end - confirm_string = register_email.parts[0].body.match(confirm_regex)[1] + confirm_string = email_text_parts(register_email)[0].body.match(confirm_regex)[1] # Check the page assert_response :success @@ -591,10 +591,10 @@ def test_user_create_windowslive_redirect assert_equal register_email.to[0], new_email # Check that the confirm account url is correct confirm_regex = Regexp.new("/user/redirect_tester_windowslive/confirm\\?confirm_string=([a-zA-Z0-9]*)") - register_email.parts.each do |part| + email_text_parts(register_email).each do |part| assert_match confirm_regex, part.body.to_s end - confirm_string = register_email.parts[0].body.match(confirm_regex)[1] + confirm_string = email_text_parts(register_email)[0].body.match(confirm_regex)[1] # Check the page assert_response :success @@ -704,10 +704,10 @@ def test_user_create_github_redirect assert_equal register_email.to[0], new_email # Check that the confirm account url is correct confirm_regex = Regexp.new("/user/redirect_tester_github/confirm\\?confirm_string=([a-zA-Z0-9]*)") - register_email.parts.each do |part| + email_text_parts(register_email).each do |part| assert_match confirm_regex, part.body.to_s end - confirm_string = register_email.parts[0].body.match(confirm_regex)[1] + confirm_string = email_text_parts(register_email)[0].body.match(confirm_regex)[1] # Check the page assert_response :success @@ -817,10 +817,10 @@ def test_user_create_wikipedia_redirect assert_equal register_email.to[0], new_email # Check that the confirm account url is correct confirm_regex = Regexp.new("/user/redirect_tester_wikipedia/confirm\\?confirm_string=([a-zA-Z0-9]*)") - register_email.parts.each do |part| + email_text_parts(register_email).each do |part| assert_match confirm_regex, part.body.to_s end - confirm_string = register_email.parts[0].body.match(confirm_regex)[1] + confirm_string = email_text_parts(register_email)[0].body.match(confirm_regex)[1] # Check the page assert_response :success diff --git a/test/test_helper.rb b/test/test_helper.rb index 9633989cda..33a1c92dac 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -185,5 +185,17 @@ def stub_hostip_requests stub_request(:get, "http://api.hostip.info/country.php?ip=0.0.0.0") stub_request(:get, "http://api.hostip.info/country.php?ip=127.0.0.1") end + + def email_text_parts(message) + text_parts = [] + message.parts.each do |part| + if part.content_type.start_with?("text/") + text_parts.push(part) + elsif part.multipart? + text_parts.concat(email_text_parts(part)) + end + end + return text_parts + end end end From e59d6c567b2af5d6bc7f5f8d4512d7bd11a3e257 Mon Sep 17 00:00:00 2001 From: Herve Saint-Amand Date: Wed, 11 Jan 2017 23:26:56 +0000 Subject: [PATCH 21/42] Rubocop finds 'return' statements redundant --- test/test_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_helper.rb b/test/test_helper.rb index 33a1c92dac..68b4a5018f 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -195,7 +195,7 @@ def email_text_parts(message) text_parts.concat(email_text_parts(part)) end end - return text_parts + text_parts end end end From 39c3fa427ea273e9011c380f9d2f2a9759cddb24 Mon Sep 17 00:00:00 2001 From: Herve Saint-Amand Date: Thu, 12 Jan 2017 21:52:17 +0000 Subject: [PATCH 22/42] Added a greeting to the changeset comment message The greeting includes the recipient's user name (as for the message notification mail), which should increase the recipient's trust that the message isn't spam. Greetings were reused from each language's respective locale flie. --- app/models/notifier.rb | 1 + app/views/notifier/changeset_comment_notification.html.erb | 4 ++++ config/locales/ar.yml | 1 + config/locales/ast.yml | 1 + config/locales/be.yml | 1 + config/locales/bn.yml | 1 + config/locales/br.yml | 1 + config/locales/bs.yml | 1 + config/locales/ca.yml | 1 + config/locales/cs.yml | 1 + config/locales/da.yml | 1 + config/locales/de.yml | 1 + config/locales/el.yml | 1 + config/locales/en-GB.yml | 1 + config/locales/en.yml | 1 + config/locales/eo.yml | 1 + config/locales/es.yml | 1 + config/locales/et.yml | 1 + config/locales/eu.yml | 1 + config/locales/fa.yml | 1 + config/locales/fi.yml | 1 + config/locales/fr.yml | 1 + config/locales/gd.yml | 1 + config/locales/gl.yml | 1 + config/locales/he.yml | 1 + config/locales/hsb.yml | 1 + config/locales/hu.yml | 1 + config/locales/ia.yml | 1 + config/locales/id.yml | 1 + config/locales/is.yml | 1 + config/locales/it.yml | 1 + config/locales/ja.yml | 1 + config/locales/ko.yml | 1 + config/locales/lb.yml | 1 + config/locales/lt.yml | 1 + config/locales/lv.yml | 1 + config/locales/mk.yml | 1 + config/locales/ms.yml | 1 + config/locales/nb.yml | 1 + config/locales/nl.yml | 1 + config/locales/oc.yml | 1 + config/locales/pl.yml | 1 + config/locales/pt-BR.yml | 1 + config/locales/pt-PT.yml | 1 + config/locales/pt.yml | 1 + config/locales/ro.yml | 1 + config/locales/ru.yml | 1 + config/locales/scn.yml | 1 + config/locales/sk.yml | 1 + config/locales/sl.yml | 1 + config/locales/sq.yml | 1 + config/locales/sr.yml | 1 + config/locales/sv.yml | 1 + config/locales/tr.yml | 1 + config/locales/uk.yml | 1 + config/locales/vi.yml | 1 + config/locales/zh-CN.yml | 1 + config/locales/zh-TW.yml | 1 + 58 files changed, 61 insertions(+) diff --git a/app/models/notifier.rb b/app/models/notifier.rb index 8f34866266..9c566f4fc3 100644 --- a/app/models/notifier.rb +++ b/app/models/notifier.rb @@ -161,6 +161,7 @@ def note_comment_notification(comment, recipient) def changeset_comment_notification(comment, recipient) with_recipient_locale recipient do + @to_user = recipient.display_name @changeset_url = changeset_url(comment.changeset, :host => SERVER_URL) @comment = comment.body @owner = recipient == comment.changeset.user diff --git a/app/views/notifier/changeset_comment_notification.html.erb b/app/views/notifier/changeset_comment_notification.html.erb index 4e271cfb2b..0ebacf40e3 100644 --- a/app/views/notifier/changeset_comment_notification.html.erb +++ b/app/views/notifier/changeset_comment_notification.html.erb @@ -1,5 +1,9 @@ <% content_for :body do %>

+ <%= t'notifier.changeset_comment_notification.hi', :to_user => @to_user %> +

+ +

<% if @owner %> <%= raw t "notifier.changeset_comment_notification.commented.your_changeset", :commenter => link_to_user(@commenter), :time => @time %> <% else %> diff --git a/config/locales/ar.yml b/config/locales/ar.yml index c774111ff3..48ca27b7e1 100644 --- a/config/locales/ar.yml +++ b/config/locales/ar.yml @@ -1170,6 +1170,7 @@ ar: بالقرب من %{place}. details: يمكن العثور على مزيد من التفاصيل حول هذه الملاحظة في %{url}. changeset_comment_notification: + hi: مرحبًا %{to_user}، greeting: مرحبا ، commented: partial_changeset_with_comment: مع تعليق '%{changeset_comment}' diff --git a/config/locales/ast.yml b/config/locales/ast.yml index 7940db1629..98d2d428d6 100644 --- a/config/locales/ast.yml +++ b/config/locales/ast.yml @@ -1308,6 +1308,7 @@ ast: La nota ta cerca de %{place}.' details: Pue alcontrar más detalles sobro la nota en %{url}. changeset_comment_notification: + hi: Bones %{to_user}, greeting: Bones, commented: subject_own: '[OpenStreetMap] %{commenter} comentó unu de los tos conxuntos diff --git a/config/locales/be.yml b/config/locales/be.yml index f9619c73eb..3b3ba0be7f 100644 --- a/config/locales/be.yml +++ b/config/locales/be.yml @@ -1325,6 +1325,7 @@ be: Заўвага каля %{place}.' details: Больш падрабязна пра ўвагу можна прачытаць на %{url}. changeset_comment_notification: + hi: Прывітанне, %{to_user}, greeting: Прывітанне, commented: subject_own: '[OpenStreetMap] %{commenter} пракаментаваў адзін з вашых набораў diff --git a/config/locales/bn.yml b/config/locales/bn.yml index 29d6c62fa6..c83d0df5ad 100644 --- a/config/locales/bn.yml +++ b/config/locales/bn.yml @@ -991,6 +991,7 @@ bn: greeting: হাই, details: টীকাটি সম্পর্কে আরও বিস্তারিত %{url|এখানে} পাওয়া যাবে। changeset_comment_notification: + hi: হাই %{to_user}, greeting: হাই, details: পরিবর্তনধার্য সম্পর্কে আরও বিস্তারিত %{url|এখানে} পাওয়া যাবে। message: diff --git a/config/locales/br.yml b/config/locales/br.yml index fdbe41dbb0..6a30af50cd 100644 --- a/config/locales/br.yml +++ b/config/locales/br.yml @@ -1320,6 +1320,7 @@ br: hoc''h eus addispleget. Emañ an notenn tost da %{place}.' details: Munudoù ouzhpenn diwar-benn an notenn a c'hall bezañ kavet e %{url}. changeset_comment_notification: + hi: Demat %{to_user}, greeting: Demat, commented: subject_own: '[OpenStreetMap] %{commenter} en deus addispleget unan eus ho diff --git a/config/locales/bs.yml b/config/locales/bs.yml index 81e353f26f..f85c5a4430 100644 --- a/config/locales/bs.yml +++ b/config/locales/bs.yml @@ -1045,6 +1045,7 @@ bs: subject_own: '[OpenStreetMap] %{commenter} je dao komentar na jednu od tvojih bilješki.' changeset_comment_notification: + hi: Zdravo %{to_user}, greeting: Zdravo, message: inbox: diff --git a/config/locales/ca.yml b/config/locales/ca.yml index 171fd03c53..6ed262c374 100644 --- a/config/locales/ca.yml +++ b/config/locales/ca.yml @@ -1363,6 +1363,7 @@ ca: heu comentat. La nota és a prop de %{place}.' details: Podeu trobar més detalls de la nota a %{url}. changeset_comment_notification: + hi: Hola %{to_user}, greeting: Hola, commented: subject_own: '[OpenStreetMap] %{commenter} ha comentat en un dels vostres diff --git a/config/locales/cs.yml b/config/locales/cs.yml index f9e2aae62e..dfce4f3e04 100644 --- a/config/locales/cs.yml +++ b/config/locales/cs.yml @@ -1326,6 +1326,7 @@ cs: Poznámka je umístěna poblíž %{place}.' details: Podrobnosti k poznámce můžete najít na %{url}. changeset_comment_notification: + hi: Dobrý den, uživateli %{to_user}, greeting: Ahoj, commented: subject_own: '[OpenStreetMap] %{commenter} okomentoval jednu z vašich sad diff --git a/config/locales/da.yml b/config/locales/da.yml index 7fc38de1ff..cce7d63811 100644 --- a/config/locales/da.yml +++ b/config/locales/da.yml @@ -1351,6 +1351,7 @@ da: Bemærkningen er i nærheden af %{place}.' details: Flere oplysninger om bemærkningen kan findes på %{url}. changeset_comment_notification: + hi: Hej %{to_user}, greeting: Hej, commented: subject_own: '[OpenStreetMap] %{commenter} har kommenteret på et af dine ændringssæt' diff --git a/config/locales/de.yml b/config/locales/de.yml index 107480c24f..01a3e203a1 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -1395,6 +1395,7 @@ de: den du kommentiert hattest, reaktivert.' details: Weitere Details über den Hinweis findest du unter %{url}. changeset_comment_notification: + hi: Hallo %{to_user}, greeting: Hallo, commented: subject_own: '[OpenStreetMap] %{commenter} hat einen deiner Änderungssätze diff --git a/config/locales/el.yml b/config/locales/el.yml index 4af67e6375..b4f5fc9177 100644 --- a/config/locales/el.yml +++ b/config/locales/el.yml @@ -1372,6 +1372,7 @@ el: details: Περισσότερες λεπτομέρειες σχετικά με τη σημείωση μπορούν να βρεθούν στο %{url}. changeset_comment_notification: + hi: Γεια σας %{to_user}, greeting: Γεια, commented: subject_own: '[OpenStreetMap] {{GENDER:%{commenter}|Ο|Η}} %{commenter} σχολίασε diff --git a/config/locales/en-GB.yml b/config/locales/en-GB.yml index 4b0ccd15e3..2334c29126 100644 --- a/config/locales/en-GB.yml +++ b/config/locales/en-GB.yml @@ -1341,6 +1341,7 @@ en-GB: on. The note is near %{place}.' details: More details about the note can be found at %{url}. changeset_comment_notification: + hi: Hi %{to_user}, greeting: Hi, commented: subject_own: '[OpenStreetMap] %{commenter} has commented on one of your changesets' diff --git a/config/locales/en.yml b/config/locales/en.yml index ab50a681ad..d9c6cc8dd7 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1310,6 +1310,7 @@ en: commented_note: "%{commenter} has reactivated a map note you have commented on. The note is near %{place}." details: "More details about the note can be found at %{url}." changeset_comment_notification: + hi: "Hi %{to_user}," greeting: "Hi," commented: subject_own: "[OpenStreetMap] %{commenter} has commented on one of your changesets" diff --git a/config/locales/eo.yml b/config/locales/eo.yml index f109b20edc..a194645117 100644 --- a/config/locales/eo.yml +++ b/config/locales/eo.yml @@ -1310,6 +1310,7 @@ eo: La rimarko troviĝis ĉe %{place}.' details: Pli da detaloj pri la rimarko, vi povas trovi je %{url}. changeset_comment_notification: + hi: Saluton %{to_user}, greeting: Saluton, commented: subject_own: '[OpenStreetMap] %{commenter} komentis vian ŝanĝaron' diff --git a/config/locales/es.yml b/config/locales/es.yml index 93c089948e..3af24d8422 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -1351,6 +1351,7 @@ es: ha comentado. La nota está cerca de %{place}.' details: Más detalles acerca de la nota pueden encontrarse en %{url}. changeset_comment_notification: + hi: Hola %{to_user}, greeting: Hola, commented: subject_own: '[OpenStreetMap] %{commenter} ha comentado en uno de tus conjuntos diff --git a/config/locales/et.yml b/config/locales/et.yml index 9d8dd5f129..71497c71dd 100644 --- a/config/locales/et.yml +++ b/config/locales/et.yml @@ -1192,6 +1192,7 @@ et: Märkus on %{place} lähedal.' details: Märkuse lisateavet leiad %{url}. changeset_comment_notification: + hi: Tere, %{to_user}! greeting: Tere! commented: subject_own: '[OpenStreetMap] %{commenter} on kommenteerinud üht sinu muudatuskogumit' diff --git a/config/locales/eu.yml b/config/locales/eu.yml index e1d16c363c..463c2bfa3d 100644 --- a/config/locales/eu.yml +++ b/config/locales/eu.yml @@ -753,6 +753,7 @@ eu: anonymous: Erabiltzale anonimoa greeting: Kaixo, changeset_comment_notification: + hi: Kaixo %{to_user}, greeting: Kaixo, message: inbox: diff --git a/config/locales/fa.yml b/config/locales/fa.yml index 9ba591beb5..fb8e3d9e5a 100644 --- a/config/locales/fa.yml +++ b/config/locales/fa.yml @@ -1321,6 +1321,7 @@ fa: اید را دوباره فعال کرد. یادداشت نزدیک %{place} است.' details: اطلاعات بیشتر درباره ی یادداشت در %{url} یافت می‌شود. changeset_comment_notification: + hi: سلام %{to_user} ، greeting: سلام ، commented: your_changeset: '%{commenter} برای جعبه تغییر ایجاد شده توسط شما در %{time} diff --git a/config/locales/fi.yml b/config/locales/fi.yml index f5f263be40..acade9d8d1 100644 --- a/config/locales/fi.yml +++ b/config/locales/fi.yml @@ -1333,6 +1333,7 @@ fi: on lähellä paikkaa %{place}.' details: Lisää tietoja merkinnästä löytyy osoitteesta %{url}. changeset_comment_notification: + hi: Hei %{to_user}, greeting: Hei, commented: partial_changeset_without_comment: ei kommenttia diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 0e9663e1ce..c63ccd7aac 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -1382,6 +1382,7 @@ fr: La note se trouve près de %{place}.' details: Plus de détails concernant la note se trouvent à %{url}. changeset_comment_notification: + hi: Bonjour %{to_user}, greeting: Bonjour, commented: subject_own: '[OpenStreetMap] %{commenter} a commenté un de vos ensembles diff --git a/config/locales/gd.yml b/config/locales/gd.yml index 66985cb22e..540bd5e0c3 100644 --- a/config/locales/gd.yml +++ b/config/locales/gd.yml @@ -1331,6 +1331,7 @@ gd: a thug thu beachd air. Tha an nòta faisg air %{place}.' details: Gheibh thu barrachd fiosrachaidh air an nòta air %{url}. changeset_comment_notification: + hi: Shin thu, %{to_user}, greeting: Shin thu, commented: subject_own: '[OpenStreetMap] Thug %{commenter} beachd air seata atharraichean diff --git a/config/locales/gl.yml b/config/locales/gl.yml index 65eaae6e80..609b6d6ea5 100644 --- a/config/locales/gl.yml +++ b/config/locales/gl.yml @@ -1342,6 +1342,7 @@ gl: vostede comentou. A nota está preto de %{place}.' details: Pode atopar máis detalles da nota en %{url}. changeset_comment_notification: + hi: 'Ola %{to_user}:' greeting: Ola, commented: subject_own: '[OpenStreetMap] %{commenter} comentou nun dos teus conxuntos diff --git a/config/locales/he.yml b/config/locales/he.yml index cdf75890c1..c7fd3e0284 100644 --- a/config/locales/he.yml +++ b/config/locales/he.yml @@ -1325,6 +1325,7 @@ he: היא ליד %{place}. details: אפשר למצוא פרטים נוספים על ההערה בכתובת %{url} changeset_comment_notification: + hi: שלום %{to_user}, greeting: שלום, commented: subject_own: '[OpenStreetMap] המשתמש %{commenter} העיר על אחד מערכות השינויים diff --git a/config/locales/hsb.yml b/config/locales/hsb.yml index 204819de03..4b61eb8b7d 100644 --- a/config/locales/hsb.yml +++ b/config/locales/hsb.yml @@ -1300,6 +1300,7 @@ hsb: komentował. Pokazka je blisko %{place}.' details: Dalše podrobnosće wo pokazce móžeš pod %{url} namakać. changeset_comment_notification: + hi: Witaj %{to_user}, greeting: Witaj, commented: subject_own: '[OpenStreetMap] %{commenter} je jednu z twojich změnow komentował(a)' diff --git a/config/locales/hu.yml b/config/locales/hu.yml index b221b0f6cd..58b90166d6 100644 --- a/config/locales/hu.yml +++ b/config/locales/hu.yml @@ -1286,6 +1286,7 @@ hu: amelyhez te is hozzászóltál, %{place} közelében.' details: 'A jegyzetről további információk: %{url}.' changeset_comment_notification: + hi: Szia %{to_user}! greeting: Szia! commented: subject_own: '[OpenStreetMap] %{commenter} hozzászólt az egyik változtatáscsomagodhoz' diff --git a/config/locales/ia.yml b/config/locales/ia.yml index 6dddc7286d..785cba61b6 100644 --- a/config/locales/ia.yml +++ b/config/locales/ia.yml @@ -1324,6 +1324,7 @@ ia: Le nota es in le vicinitate de %{place}.' details: Plus detalios sur le nota pote esser trovate a %{url}. changeset_comment_notification: + hi: Salute %{to_user}, greeting: Salute, commented: subject_own: '[OpenStreetMap] %{commenter} ha commentate un de tu gruppos diff --git a/config/locales/id.yml b/config/locales/id.yml index 87fa9c86bd..53489e24b2 100644 --- a/config/locales/id.yml +++ b/config/locales/id.yml @@ -1354,6 +1354,7 @@ id: yang Anda komentari. Catatan ini dekat %{place}.' details: Rincian lebih lanjut mengenai catatan dapat ditemukan di %{url}. changeset_comment_notification: + hi: Halo %{to_user}, greeting: Halo, commented: subject_own: '[OpenStreetMap] %{commenter} mengomentari salah satu perubahan diff --git a/config/locales/is.yml b/config/locales/is.yml index a8d1323d01..17edb35b9a 100644 --- a/config/locales/is.yml +++ b/config/locales/is.yml @@ -981,6 +981,7 @@ is: anonymous: Nafnlaus notandi greeting: Hæ, changeset_comment_notification: + hi: Hæ %{to_user}, greeting: Hæ, message: inbox: diff --git a/config/locales/it.yml b/config/locales/it.yml index 22b1782dbe..bc4aa320e4 100644 --- a/config/locales/it.yml +++ b/config/locales/it.yml @@ -1363,6 +1363,7 @@ it: La nota si trova vicino a %{place}.' details: Ulteriori dettagli sulla nota possono essere trovati su %{url}. changeset_comment_notification: + hi: Salve %{to_user}, greeting: Ciao, commented: subject_own: '[OpenStreetMap] %{commenter} ha commentato uno dei tuoi changeset' diff --git a/config/locales/ja.yml b/config/locales/ja.yml index d58cbc734e..eb5698faf3 100644 --- a/config/locales/ja.yml +++ b/config/locales/ja.yml @@ -1210,6 +1210,7 @@ ja: commented_note: '%{commenter}さんが、%{place}付近にあるあなたがコメントした地図メモを再開しました。' details: メモについての詳細は %{url} を参照。 changeset_comment_notification: + hi: こんにちは、%{to_user} さん。 greeting: こんにちは、 commented: partial_changeset_without_comment: コメントなし diff --git a/config/locales/ko.yml b/config/locales/ko.yml index 6bb87ee2f5..cd69b11ba4 100644 --- a/config/locales/ko.yml +++ b/config/locales/ko.yml @@ -1311,6 +1311,7 @@ ko: 근처에 있습니다.' details: 참고에 대한 자세한 사항은 %{url}에서 찾을 수 있습니다. changeset_comment_notification: + hi: 안녕하세요 %{to_user}님, greeting: 안녕하세요, commented: subject_own: '[OpenStreetMap] %{commenter}님이 당신의 바뀜집합 중 하나에 댓글을 남겼습니다' diff --git a/config/locales/lb.yml b/config/locales/lb.yml index e5f51d08a3..ce700c9699 100644 --- a/config/locales/lb.yml +++ b/config/locales/lb.yml @@ -697,6 +697,7 @@ lb: greeting: Salut, details: Méi Detailer iwwer d'Notiz fannt Dir op %{url}. changeset_comment_notification: + hi: Salut %{to_user}, greeting: Salut, message: inbox: diff --git a/config/locales/lt.yml b/config/locales/lt.yml index 6aefd05b8a..5134dbeeff 100644 --- a/config/locales/lt.yml +++ b/config/locales/lt.yml @@ -1319,6 +1319,7 @@ lt: Pastaba yra netoli %{place}.' details: Daugiau informacijos apie pastabą galima rasti %{url}. changeset_comment_notification: + hi: Sveiki, %{to_user}, greeting: Labas, commented: subject_own: '[OpenStreetMap] %{commenter} pakomentavo vieną iš jūsų pakeitimų' diff --git a/config/locales/lv.yml b/config/locales/lv.yml index 713d270e82..e4576d7be2 100644 --- a/config/locales/lv.yml +++ b/config/locales/lv.yml @@ -1326,6 +1326,7 @@ lv: kur esi komentējis. Piezīme ir netālu no %{place}.' details: Vairāk informācijas par piezīmēm var atrast %{url}. changeset_comment_notification: + hi: Sveiks %{to_user}, greeting: Sveicināti, commented: subject_own: '[OpenStreetMap] %{commenter} ir komentējis kādu no tavām izmaiņām' diff --git a/config/locales/mk.yml b/config/locales/mk.yml index efee7dbd93..a900848ad8 100644 --- a/config/locales/mk.yml +++ b/config/locales/mk.yml @@ -1331,6 +1331,7 @@ mk: Белешката се наоѓа близу %{place}.' details: Поподробно за белешката на %{url}. changeset_comment_notification: + hi: Здраво %{to_user}, greeting: Здраво, commented: subject_own: '[OpenStreetMap] %{commenter} искоментира на една од вашите промени' diff --git a/config/locales/ms.yml b/config/locales/ms.yml index ecb0c7bcc3..8d59b8b120 100644 --- a/config/locales/ms.yml +++ b/config/locales/ms.yml @@ -1263,6 +1263,7 @@ ms: yang pernah anda ulas dekat %{place}.' details: Butiran lanjut tentang nota berkenaan boleh didapati di %{url}. changeset_comment_notification: + hi: Apa khabar %{to_user}, greeting: Apa khabar, commented: partial_changeset_with_comment: dengan komen '%{changeset_comment}' diff --git a/config/locales/nb.yml b/config/locales/nb.yml index c6ee472f4c..cdbd4024a9 100644 --- a/config/locales/nb.yml +++ b/config/locales/nb.yml @@ -1327,6 +1327,7 @@ nb: på. Merknaden er i nærheten av %{place}.' details: Flere opplysninger om merknaden finner du på %{url}. changeset_comment_notification: + hi: Hei %{to_user}, greeting: Hei, commented: subject_own: '[OpenStreetMap] %{commenter} har kommentert en av dine endringer' diff --git a/config/locales/nl.yml b/config/locales/nl.yml index 642a597113..a7d81f88bf 100644 --- a/config/locales/nl.yml +++ b/config/locales/nl.yml @@ -1376,6 +1376,7 @@ nl: opnieuw geactiveerd. De opmerking is gemaakt bij %{place}.' details: Meer details over de opmerking zijn te vinden op %{url}. changeset_comment_notification: + hi: Hallo %{to_user}, greeting: Hallo, commented: subject_own: '[OpenStreetMap] %{commenter} heeft gereageerd op een van uw diff --git a/config/locales/oc.yml b/config/locales/oc.yml index 158fc31400..34a7a47254 100644 --- a/config/locales/oc.yml +++ b/config/locales/oc.yml @@ -1188,6 +1188,7 @@ oc: La nòta se tròba prèp de %{place}.' details: Mai de detalh sus la nòta pòt èsser obtengut a %{url}. changeset_comment_notification: + hi: Bonjorn %{to_user}, greeting: Bonjorn, commented: partial_changeset_with_comment: amb lo comentari '%{changeset_comment}' diff --git a/config/locales/pl.yml b/config/locales/pl.yml index 33c76f1e40..6e61cef172 100644 --- a/config/locales/pl.yml +++ b/config/locales/pl.yml @@ -1353,6 +1353,7 @@ pl: Znajduje się ona w położeniu %{place}. details: 'Więcej informacji na temat uwagi można znaleźć pod adresem: %{url}.' changeset_comment_notification: + hi: Witaj %{to_user}, greeting: Cześć, commented: subject_own: '[OpenStreetMap] %{commenter} skomentował jeden z twoich zestawów diff --git a/config/locales/pt-BR.yml b/config/locales/pt-BR.yml index e80f896953..c4170b3d4e 100644 --- a/config/locales/pt-BR.yml +++ b/config/locales/pt-BR.yml @@ -1366,6 +1366,7 @@ pt-BR: A nota está perto de %{place}.' details: Mais detalhes sobre a nota podem ser encontrados em %{url}. changeset_comment_notification: + hi: Olá %{to_user}, greeting: Olá, commented: subject_own: '[OpenStreetMap] %{commenter} comentou um conjunto de alterações diff --git a/config/locales/pt-PT.yml b/config/locales/pt-PT.yml index 8aaf8bc13f..34b65b2a40 100644 --- a/config/locales/pt-PT.yml +++ b/config/locales/pt-PT.yml @@ -1348,6 +1348,7 @@ pt-PT: O erro encontra-se perto de %{place}.' details: Ver mais detalhes sobre o erro reportado em %{url}. changeset_comment_notification: + hi: Olá %{to_user}, greeting: Olá, commented: subject_own: '[OpenStreetMap] %{commenter} comentou uma das suas edições' diff --git a/config/locales/pt.yml b/config/locales/pt.yml index 92da7e6fe3..c0965d2a1a 100644 --- a/config/locales/pt.yml +++ b/config/locales/pt.yml @@ -1239,6 +1239,7 @@ pt: O erro encontra-se perto de %{place}.' details: Ver mais detalhes sobre o erro reportado em %{url}. changeset_comment_notification: + hi: Olá %{to_user}, greeting: Olá, message: inbox: diff --git a/config/locales/ro.yml b/config/locales/ro.yml index 0b68f9c993..ceb35255b6 100644 --- a/config/locales/ro.yml +++ b/config/locales/ro.yml @@ -840,6 +840,7 @@ ro: note_comment_notification: greeting: Salut, changeset_comment_notification: + hi: Salut, %{to_user}, greeting: Salut, message: inbox: diff --git a/config/locales/ru.yml b/config/locales/ru.yml index e1826e75ed..1ccb53349e 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -1369,6 +1369,7 @@ ru: Отметка недалеко от %{place}.' details: Подробнее о заметке %{url}. changeset_comment_notification: + hi: Привет, %{to_user}, greeting: Привет, commented: subject_own: '[OpenStreetMap] %{commenter} прокомментировал один из ваших diff --git a/config/locales/scn.yml b/config/locales/scn.yml index 695d3d29f4..9be1edbb46 100644 --- a/config/locales/scn.yml +++ b/config/locales/scn.yml @@ -1329,6 +1329,7 @@ scn: tu cummintasti. La nota s''attrova vicinu a %{place}.' details: Poi attruvari àutri dittagghî di sta nota nta %{url}. changeset_comment_notification: + hi: Salutamu %{to_user}, greeting: Salutamu, commented: subject_own: '[OpenStreetMap] %{commenter} cummintau unu dî tò gruppa di canciamenti' diff --git a/config/locales/sk.yml b/config/locales/sk.yml index 735effe7da..fa563f920c 100644 --- a/config/locales/sk.yml +++ b/config/locales/sk.yml @@ -1155,6 +1155,7 @@ sk: greeting: Ahoj, details: Viac podrobností o poznámke môžete nájsť nájsť na %{url}. changeset_comment_notification: + hi: Ahoj %{to_user}, greeting: Ahoj, message: inbox: diff --git a/config/locales/sl.yml b/config/locales/sl.yml index dbfed4848e..a6281c97a4 100644 --- a/config/locales/sl.yml +++ b/config/locales/sl.yml @@ -1156,6 +1156,7 @@ sl: ki ste jo vi komentirali. Opomba je v bližini %{place}.' details: Več podrobnosti o opombi lahko najdete na %{url}. changeset_comment_notification: + hi: Pozdravljeni, %{to_user}, greeting: Pozdravljeni, commented: subject_own: '[OpenStreetMap] %{commenter} je komentiral enega izmed vaših diff --git a/config/locales/sq.yml b/config/locales/sq.yml index dcc6e827b2..12ba6693f9 100644 --- a/config/locales/sq.yml +++ b/config/locales/sq.yml @@ -1052,6 +1052,7 @@ sq: note_comment_notification: greeting: Përshëndetje, changeset_comment_notification: + hi: Përshëndetje %{to_user}, greeting: Përshëndetje, commented: partial_changeset_without_comment: pa koment diff --git a/config/locales/sr.yml b/config/locales/sr.yml index 1d16679b22..a442348752 100644 --- a/config/locales/sr.yml +++ b/config/locales/sr.yml @@ -1228,6 +1228,7 @@ sr: anonymous: Анонимни корисник greeting: Поздрав, changeset_comment_notification: + hi: Поздрав, %{to_user}, greeting: Поздрав, commented: partial_changeset_without_comment: без коментара diff --git a/config/locales/sv.yml b/config/locales/sv.yml index f9ef716a11..e2792d6084 100644 --- a/config/locales/sv.yml +++ b/config/locales/sv.yml @@ -1366,6 +1366,7 @@ sv: på. Noteringen är nära %{place}.' details: Mer detaljer om anteckningen finns på %{url}. changeset_comment_notification: + hi: Hej %{to_user}, greeting: Hej, commented: subject_own: '[OpenStreetMap] %{commenter} har kommenterat på en av dina ändringsset' diff --git a/config/locales/tr.yml b/config/locales/tr.yml index 4a8aec2ad5..0afaa5522e 100644 --- a/config/locales/tr.yml +++ b/config/locales/tr.yml @@ -1139,6 +1139,7 @@ tr: subject_own: '[OpenStreetMap] notlarından birisini %{commenter} tarafından yorumlandı' changeset_comment_notification: + hi: Merhaba %{to_user}, greeting: Merhaba, commented: partial_changeset_without_comment: yorumsuz diff --git a/config/locales/uk.yml b/config/locales/uk.yml index 8416e83d7f..4efe486280 100644 --- a/config/locales/uk.yml +++ b/config/locales/uk.yml @@ -1337,6 +1337,7 @@ uk: біля %{place}.' details: Докладніше про нотатку %{url}. changeset_comment_notification: + hi: Привіт, %{to_user}, greeting: Привіт, commented: subject_own: '[OpenStreetMap] %{commenter} прокоментував один з ваших наборів diff --git a/config/locales/vi.yml b/config/locales/vi.yml index 5aeba831b1..b9751cedaf 100644 --- a/config/locales/vi.yml +++ b/config/locales/vi.yml @@ -1310,6 +1310,7 @@ vi: chú gần %{place}.' details: Xem chi tiết về ghi chú tại %{url}. changeset_comment_notification: + hi: Chào %{to_user}, greeting: Chào bạn, commented: subject_own: '[OpenStreetMap] %{commenter} đã bình luận về một bộ thay đổi diff --git a/config/locales/zh-CN.yml b/config/locales/zh-CN.yml index 0f3a8d27d4..39e035e21a 100644 --- a/config/locales/zh-CN.yml +++ b/config/locales/zh-CN.yml @@ -1225,6 +1225,7 @@ zh-CN: commented_note: '%{commenter} 重新激活了您感兴趣的一个地图笔记。该笔记位于 %{place} 附近。' details: 更多关于笔记的详细信息可以在%{url}找到。 changeset_comment_notification: + hi: 您好,%{to_user}: greeting: 您好, commented: subject_own: '[OpenStreetMap] %{commenter}在您的一个修改集合中做出了评论' diff --git a/config/locales/zh-TW.yml b/config/locales/zh-TW.yml index 70168f5126..3936da8fe9 100644 --- a/config/locales/zh-TW.yml +++ b/config/locales/zh-TW.yml @@ -1243,6 +1243,7 @@ zh-TW: commented_note: '%{commenter} 重新開啟了一個您曾評論的地圖註記。該註記位於 %{place} 附近。' details: 關於註記的更多詳細資料可在 %{url} 找到。 changeset_comment_notification: + hi: '%{to_user} 您好,' greeting: 您好, commented: subject_own: '[OpenStreetMap] %{commenter}% 在您的變更集評論' From 22f7c1f721e5a77786f9f61fa219f262784757ac Mon Sep 17 00:00:00 2001 From: Herve Saint-Amand Date: Thu, 12 Jan 2017 22:11:23 +0000 Subject: [PATCH 23/42] Dressed up friend_notification mail --- app/models/notifier.rb | 2 ++ app/views/notifier/friend_notification.html.erb | 14 +++++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/app/models/notifier.rb b/app/models/notifier.rb index 9c566f4fc3..d7fa66c4ad 100644 --- a/app/models/notifier.rb +++ b/app/models/notifier.rb @@ -129,7 +129,9 @@ def friend_notification(friend) @friendurl = url_for(:host => SERVER_URL, :controller => "user", :action => "make_friend", :display_name => @friend.befriender.display_name) + @user_message_author = @friend.befriender.display_name + attach_user_avatar(@friend.befriender) mail :to => friend.befriendee.email, :subject => I18n.t("notifier.friend_notification.subject", :user => friend.befriender.display_name) end diff --git a/app/views/notifier/friend_notification.html.erb b/app/views/notifier/friend_notification.html.erb index 181b2b8253..3f260dc928 100644 --- a/app/views/notifier/friend_notification.html.erb +++ b/app/views/notifier/friend_notification.html.erb @@ -1,7 +1,11 @@ -

<%= t 'notifier.friend_notification.had_added_you', :user => @friend.befriender.display_name %>

+<% content_for :body do %> +

<%= t 'notifier.friend_notification.had_added_you', :user => @friend.befriender.display_name %>

-

<%= raw t 'notifier.friend_notification.see_their_profile', :userurl => link_to(@viewurl, @viewurl) %>

+ <%= render "notifier/user_message_table", :captured => capture { %> +

<%= raw t 'notifier.friend_notification.see_their_profile', :userurl => link_to(@viewurl, @viewurl) %>

-<% unless @friend.befriendee.is_friends_with?(@friend.befriender) -%> -

<%= raw t 'notifier.friend_notification.befriend_them', :befriendurl => link_to(@friendurl, @friendurl) %>

-<% end -%> + <% unless @friend.befriendee.is_friends_with?(@friend.befriender) -%> +

<%= raw t 'notifier.friend_notification.befriend_them', :befriendurl => link_to(@friendurl, @friendurl) %>

+ <% end -%> + <% } %> +<% end %> From 6d1c10afbc3641095c515152f6ae07a0b9ddffcf Mon Sep 17 00:00:00 2001 From: Herve Saint-Amand Date: Thu, 12 Jan 2017 22:28:09 +0000 Subject: [PATCH 24/42] Dressed up gpx notification mails --- app/views/notifier/_gpx_description.html.erb | 20 +++++++++---------- app/views/notifier/gpx_failure.html.erb | 21 ++++++++++++++------ app/views/notifier/gpx_success.html.erb | 10 ++++++++-- 3 files changed, 32 insertions(+), 19 deletions(-) diff --git a/app/views/notifier/_gpx_description.html.erb b/app/views/notifier/_gpx_description.html.erb index 2825799197..8d44336c99 100644 --- a/app/views/notifier/_gpx_description.html.erb +++ b/app/views/notifier/_gpx_description.html.erb @@ -1,14 +1,12 @@ -<%= t'notifier.gpx_notification.greeting' %> - <%= t'notifier.gpx_notification.your_gpx_file' %> - - <%= @trace_name %> - +<%= @trace_name %> <%= t'notifier.gpx_notification.with_description' %> - - <%= @trace_description %> +<%= @trace_description %> <% if @trace_tags.length>0 %> -<%= t'notifier.gpx_notification.and_the_tags' %> -<% @trace_tags.each do |tag| %> - <%= tag.tag.rstrip %><% end %><% else %> -<%= t'notifier.gpx_notification.and_no_tags' %><% end %> + <%= t'notifier.gpx_notification.and_the_tags' %> + <% @trace_tags.each do |tag| %> + <%= tag.tag.rstrip %> + <% end %> +<% else %> + <%= t'notifier.gpx_notification.and_no_tags' %> +<% end %> diff --git a/app/views/notifier/gpx_failure.html.erb b/app/views/notifier/gpx_failure.html.erb index f59aa3dbbf..d1319acbd1 100644 --- a/app/views/notifier/gpx_failure.html.erb +++ b/app/views/notifier/gpx_failure.html.erb @@ -1,9 +1,18 @@ -<%= render :partial => "gpx_description" %> -<%= t'notifier.gpx_notification.failure.failed_to_import' %> +<% content_for :body do %> +

<%= t'notifier.gpx_notification.greeting' %>

- <%= @error %> +

+ <%= render :partial => "gpx_description" %> + <%= t'notifier.gpx_notification.failure.failed_to_import' %> +

-<%= t'notifier.gpx_notification.failure.more_info_1' %> -<%= t'notifier.gpx_notification.failure.more_info_2' %> +
+ <%= @error %> +
- <%= t'notifier.gpx_notification.failure.import_failures_url' %> +

+ <%= t'notifier.gpx_notification.failure.more_info_1' %> + <%= t'notifier.gpx_notification.failure.more_info_2' %> + <%= t'notifier.gpx_notification.failure.import_failures_url' %> +

+<% end %> diff --git a/app/views/notifier/gpx_success.html.erb b/app/views/notifier/gpx_success.html.erb index 1983fe71c2..97267944e8 100644 --- a/app/views/notifier/gpx_success.html.erb +++ b/app/views/notifier/gpx_success.html.erb @@ -1,2 +1,8 @@ -<%= render :partial => "gpx_description" %> -<%= t'notifier.gpx_notification.success.loaded_successfully', :trace_points => @trace_points, :possible_points => @possible_points %> +<% content_for :body do %> +

<%= t'notifier.gpx_notification.greeting' %>

+ +

+ <%= render :partial => "gpx_description" %> + <%= t'notifier.gpx_notification.success.loaded_successfully', :trace_points => @trace_points, :possible_points => @possible_points %> +

+<% end %> From 235e77fc26fabcf92db09a1b3d965257621c846e Mon Sep 17 00:00:00 2001 From: Herve Saint-Amand Date: Thu, 12 Jan 2017 22:30:31 +0000 Subject: [PATCH 25/42] Dressed up lost password mail --- app/views/notifier/lost_password.html.erb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/views/notifier/lost_password.html.erb b/app/views/notifier/lost_password.html.erb index 5f1012ac6d..17862df673 100644 --- a/app/views/notifier/lost_password.html.erb +++ b/app/views/notifier/lost_password.html.erb @@ -1,7 +1,9 @@ -

<%= t 'notifier.lost_password_html.greeting' %>

+<% content_for :body do %> +

<%= t 'notifier.lost_password_html.greeting' %>

-

<%= t 'notifier.lost_password_html.hopefully_you' %>

+

<%= t 'notifier.lost_password_html.hopefully_you' %>

-

<%= t 'notifier.lost_password_html.click_the_link' %>

+

<%= t 'notifier.lost_password_html.click_the_link' %>

-

<%= @url %>

+

<%= @url %>

+<% end %> From 7ef57b2fe858689370dea6852b196d2213dacefa Mon Sep 17 00:00:00 2001 From: Herve Saint-Amand Date: Thu, 12 Jan 2017 23:02:57 +0000 Subject: [PATCH 26/42] Dressed up note comment messages --- app/models/notifier.rb | 7 ++++-- .../note_comment_notification.html.erb | 22 ++++++++++--------- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/app/models/notifier.rb b/app/models/notifier.rb index d7fa66c4ad..73cbbad541 100644 --- a/app/models/notifier.rb +++ b/app/models/notifier.rb @@ -151,6 +151,9 @@ def note_comment_notification(comment, recipient) I18n.t("notifier.note_comment_notification.anonymous") end + @user_message_author = @commenter + attach_user_avatar(comment.author) + subject = if @owner I18n.t("notifier.note_comment_notification.#{@event}.subject_own", :commenter => @commenter) else @@ -202,8 +205,8 @@ def attach_user_avatar(user) end def user_avatar_file_path(user) - image = user.image - if image.file? + image = user && user.image + if image && image.file? return image.path(:small) else return "#{Rails.root}/app/assets/images/users/images/small.png" diff --git a/app/views/notifier/note_comment_notification.html.erb b/app/views/notifier/note_comment_notification.html.erb index d82723bbb8..ab4378fa27 100644 --- a/app/views/notifier/note_comment_notification.html.erb +++ b/app/views/notifier/note_comment_notification.html.erb @@ -1,13 +1,15 @@ -

<%= t 'notifier.note_comment_notification.greeting' %>

+<% content_for :body do %> +

<%= t 'notifier.note_comment_notification.greeting' %>

-<% if @owner %> -

<%= t "notifier.note_comment_notification.#{@event}.your_note", :commenter => @commenter, :place => @place %>

-<% else %> -

<%= t "notifier.note_comment_notification.#{@event}.commented_note", :commenter => @commenter, :place => @place %>

-<% end %> + <% if @owner %> +

<%= raw t "notifier.note_comment_notification.#{@event}.your_note", :commenter => link_to_user(@commenter), :place => @place %>

+ <% else %> +

<%= raw t "notifier.note_comment_notification.#{@event}.commented_note", :commenter => link_to_user(@commenter), :place => @place %>

+ <% end %> -== -<%= @comment.to_html %> -== + <%= render "notifier/user_message_table", :captured => capture { %> + <%= @comment.to_html %> + <% } %> -

<%= raw t 'notifier.note_comment_notification.details', :url => link_to(@noteurl, @noteurl) %>

+

<%= raw t 'notifier.note_comment_notification.details', :url => link_to(@noteurl, @noteurl) %>

+<% end %> From 75f96fcc9a8f07828d6dc2f487bb00307de7a94f Mon Sep 17 00:00:00 2001 From: Herve Saint-Amand Date: Fri, 13 Jan 2017 21:45:52 +0000 Subject: [PATCH 27/42] Logo was being attached twice on changeset comment notifications --- app/models/notifier.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/app/models/notifier.rb b/app/models/notifier.rb index 73cbbad541..7878c601ce 100644 --- a/app/models/notifier.rb +++ b/app/models/notifier.rb @@ -182,7 +182,6 @@ def changeset_comment_notification(comment, recipient) I18n.t("notifier.changeset_comment_notification.commented.subject_other", :commenter => @commenter) end - attach_project_logo attach_user_avatar(comment.author) mail :to => recipient.email, :subject => subject From c94213847b8e5b71864b34748ba9fadaefbfddfe Mon Sep 17 00:00:00 2001 From: Herve Saint-Amand Date: Fri, 13 Jan 2017 22:43:23 +0000 Subject: [PATCH 28/42] Simplified the partial layout Rather than wrap the body in a :body block, just make it the default, unnamed block, which keeps the markup more lightweight. --- app/views/layouts/notifier.html.erb | 2 +- .../changeset_comment_notification.html.erb | 44 +++++++++---------- .../diary_comment_notification.html.erb | 20 ++++----- app/views/notifier/email_confirm.html.erb | 10 ++--- .../notifier/friend_notification.html.erb | 16 +++---- app/views/notifier/gpx_failure.html.erb | 28 ++++++------ app/views/notifier/gpx_success.html.erb | 12 +++-- app/views/notifier/lost_password.html.erb | 10 ++--- .../notifier/message_notification.html.erb | 26 +++++------ .../note_comment_notification.html.erb | 22 +++++----- app/views/notifier/signup_confirm.html.erb | 12 +++-- 11 files changed, 91 insertions(+), 111 deletions(-) diff --git a/app/views/layouts/notifier.html.erb b/app/views/layouts/notifier.html.erb index fb001d7c15..3b8ce6657b 100644 --- a/app/views/layouts/notifier.html.erb +++ b/app/views/layouts/notifier.html.erb @@ -25,7 +25,7 @@
- <%= yield :body %> + <%= yield %>
diff --git a/app/views/notifier/changeset_comment_notification.html.erb b/app/views/notifier/changeset_comment_notification.html.erb index 0ebacf40e3..0d97b402a5 100644 --- a/app/views/notifier/changeset_comment_notification.html.erb +++ b/app/views/notifier/changeset_comment_notification.html.erb @@ -1,29 +1,27 @@ -<% content_for :body do %> -

- <%= t'notifier.changeset_comment_notification.hi', :to_user => @to_user %> -

+

+ <%= t'notifier.changeset_comment_notification.hi', :to_user => @to_user %> +

-

- <% if @owner %> - <%= raw t "notifier.changeset_comment_notification.commented.your_changeset", :commenter => link_to_user(@commenter), :time => @time %> - <% else %> - <%= raw t "notifier.changeset_comment_notification.commented.commented_changeset", :commenter => link_to_user(@commenter), :time => @time, :changeset_author => @changeset_author %> - <% end %> - <% if @changeset_comment %> - <%= raw t "notifier.changeset_comment_notification.commented.partial_changeset_with_comment", :changeset_comment => content_tag("em", @changeset_comment) %> - <% else %> - <%= t "notifier.changeset_comment_notification.commented.partial_changeset_without_comment" %> - <% end %> -

+

+ <% if @owner %> + <%= raw t "notifier.changeset_comment_notification.commented.your_changeset", :commenter => link_to_user(@commenter), :time => @time %> + <% else %> + <%= raw t "notifier.changeset_comment_notification.commented.commented_changeset", :commenter => link_to_user(@commenter), :time => @time, :changeset_author => @changeset_author %> + <% end %> + <% if @changeset_comment %> + <%= raw t "notifier.changeset_comment_notification.commented.partial_changeset_with_comment", :changeset_comment => content_tag("em", @changeset_comment) %> + <% else %> + <%= t "notifier.changeset_comment_notification.commented.partial_changeset_without_comment" %> + <% end %> +

- <%= render "notifier/user_message_table", :captured => capture { %> - <%= @comment.to_html %> - <% } %> +<%= render "notifier/user_message_table", :captured => capture { %> + <%= @comment.to_html %> +<% } %> -

- <%= raw t 'notifier.changeset_comment_notification.details', :url => content_tag("nobr", link_to(@changeset_url, @changeset_url)) %> -

-<% end %> +

+ <%= raw t 'notifier.changeset_comment_notification.details', :url => content_tag("nobr", link_to(@changeset_url, @changeset_url)) %> +

<% content_for :footer do %>

diff --git a/app/views/notifier/diary_comment_notification.html.erb b/app/views/notifier/diary_comment_notification.html.erb index ea9a655910..e37f682a33 100644 --- a/app/views/notifier/diary_comment_notification.html.erb +++ b/app/views/notifier/diary_comment_notification.html.erb @@ -1,15 +1,13 @@ -<% content_for :body do %> -

- <%= t'notifier.diary_comment_notification.hi', :to_user => @to_user %> -

-

- <%= raw t'notifier.diary_comment_notification.header', :from_user => link_to_user(@from_user), :subject => content_tag("em", @title) %> -

+

+ <%= t'notifier.diary_comment_notification.hi', :to_user => @to_user %> +

+

+ <%= raw t'notifier.diary_comment_notification.header', :from_user => link_to_user(@from_user), :subject => content_tag("em", @title) %> +

- <%= render "notifier/user_message_table", :captured => capture { %> - <%= @text.to_html %> - <% } %> -<% end %> +<%= render "notifier/user_message_table", :captured => capture { %> + <%= @text.to_html %> +<% } %> <% content_for :footer do %>

<%= raw t'notifier.diary_comment_notification.footer', diff --git a/app/views/notifier/email_confirm.html.erb b/app/views/notifier/email_confirm.html.erb index 5c639d57fd..2afbfcbf62 100644 --- a/app/views/notifier/email_confirm.html.erb +++ b/app/views/notifier/email_confirm.html.erb @@ -1,9 +1,7 @@ -<% content_for :body do %> -

<%= t 'notifier.email_confirm_html.greeting' %>

+

<%= t 'notifier.email_confirm_html.greeting' %>

-

<%= t 'notifier.email_confirm_html.hopefully_you', :server_url => SERVER_URL, :new_address => @address %>

+

<%= t 'notifier.email_confirm_html.hopefully_you', :server_url => SERVER_URL, :new_address => @address %>

-

<%= t 'notifier.email_confirm_html.click_the_link' %>

+

<%= t 'notifier.email_confirm_html.click_the_link' %>

-

<%= @url %>

-<% end %> +

<%= @url %>

diff --git a/app/views/notifier/friend_notification.html.erb b/app/views/notifier/friend_notification.html.erb index 3f260dc928..91de4b7320 100644 --- a/app/views/notifier/friend_notification.html.erb +++ b/app/views/notifier/friend_notification.html.erb @@ -1,11 +1,9 @@ -<% content_for :body do %> -

<%= t 'notifier.friend_notification.had_added_you', :user => @friend.befriender.display_name %>

+

<%= t 'notifier.friend_notification.had_added_you', :user => @friend.befriender.display_name %>

- <%= render "notifier/user_message_table", :captured => capture { %> -

<%= raw t 'notifier.friend_notification.see_their_profile', :userurl => link_to(@viewurl, @viewurl) %>

+<%= render "notifier/user_message_table", :captured => capture { %> +

<%= raw t 'notifier.friend_notification.see_their_profile', :userurl => link_to(@viewurl, @viewurl) %>

- <% unless @friend.befriendee.is_friends_with?(@friend.befriender) -%> -

<%= raw t 'notifier.friend_notification.befriend_them', :befriendurl => link_to(@friendurl, @friendurl) %>

- <% end -%> - <% } %> -<% end %> + <% unless @friend.befriendee.is_friends_with?(@friend.befriender) -%> +

<%= raw t 'notifier.friend_notification.befriend_them', :befriendurl => link_to(@friendurl, @friendurl) %>

+ <% end -%> +<% } %> diff --git a/app/views/notifier/gpx_failure.html.erb b/app/views/notifier/gpx_failure.html.erb index d1319acbd1..cc43905b2a 100644 --- a/app/views/notifier/gpx_failure.html.erb +++ b/app/views/notifier/gpx_failure.html.erb @@ -1,18 +1,16 @@ -<% content_for :body do %> -

<%= t'notifier.gpx_notification.greeting' %>

+

<%= t'notifier.gpx_notification.greeting' %>

-

- <%= render :partial => "gpx_description" %> - <%= t'notifier.gpx_notification.failure.failed_to_import' %> -

+

+ <%= render :partial => "gpx_description" %> + <%= t'notifier.gpx_notification.failure.failed_to_import' %> +

-
- <%= @error %> -
+
+ <%= @error %> +
-

- <%= t'notifier.gpx_notification.failure.more_info_1' %> - <%= t'notifier.gpx_notification.failure.more_info_2' %> - <%= t'notifier.gpx_notification.failure.import_failures_url' %> -

-<% end %> +

+ <%= t'notifier.gpx_notification.failure.more_info_1' %> + <%= t'notifier.gpx_notification.failure.more_info_2' %> + <%= t'notifier.gpx_notification.failure.import_failures_url' %> +

diff --git a/app/views/notifier/gpx_success.html.erb b/app/views/notifier/gpx_success.html.erb index 97267944e8..8e24088456 100644 --- a/app/views/notifier/gpx_success.html.erb +++ b/app/views/notifier/gpx_success.html.erb @@ -1,8 +1,6 @@ -<% content_for :body do %> -

<%= t'notifier.gpx_notification.greeting' %>

+

<%= t'notifier.gpx_notification.greeting' %>

-

- <%= render :partial => "gpx_description" %> - <%= t'notifier.gpx_notification.success.loaded_successfully', :trace_points => @trace_points, :possible_points => @possible_points %> -

-<% end %> +

+ <%= render :partial => "gpx_description" %> + <%= t'notifier.gpx_notification.success.loaded_successfully', :trace_points => @trace_points, :possible_points => @possible_points %> +

diff --git a/app/views/notifier/lost_password.html.erb b/app/views/notifier/lost_password.html.erb index 17862df673..520d1097a2 100644 --- a/app/views/notifier/lost_password.html.erb +++ b/app/views/notifier/lost_password.html.erb @@ -1,9 +1,7 @@ -<% content_for :body do %> -

<%= t 'notifier.lost_password_html.greeting' %>

+

<%= t 'notifier.lost_password_html.greeting' %>

-

<%= t 'notifier.lost_password_html.hopefully_you' %>

+

<%= t 'notifier.lost_password_html.hopefully_you' %>

-

<%= t 'notifier.lost_password_html.click_the_link' %>

+

<%= t 'notifier.lost_password_html.click_the_link' %>

-

<%= @url %>

-<% end %> +

<%= @url %>

diff --git a/app/views/notifier/message_notification.html.erb b/app/views/notifier/message_notification.html.erb index 823f1487aa..7a4ac66a5a 100644 --- a/app/views/notifier/message_notification.html.erb +++ b/app/views/notifier/message_notification.html.erb @@ -1,18 +1,16 @@ -<% content_for :body do %> -

- <%= t'notifier.message_notification.hi', :to_user => @to_user %> -

-

- <%= raw t'notifier.message_notification.header', - :from_user => link_to_user(@from_user), - :subject => content_tag("em", @title) - %> -

+

+ <%= t'notifier.message_notification.hi', :to_user => @to_user %> +

+

+ <%= raw t'notifier.message_notification.header', + :from_user => link_to_user(@from_user), + :subject => content_tag("em", @title) + %> +

- <%= render "notifier/user_message_table", :captured => capture { %> - <%= @text.to_html %> - <% } %> -<% end %> +<%= render "notifier/user_message_table", :captured => capture { %> + <%= @text.to_html %> +<% } %> <% content_for :footer do %>

diff --git a/app/views/notifier/note_comment_notification.html.erb b/app/views/notifier/note_comment_notification.html.erb index ab4378fa27..88b8f9603d 100644 --- a/app/views/notifier/note_comment_notification.html.erb +++ b/app/views/notifier/note_comment_notification.html.erb @@ -1,15 +1,13 @@ -<% content_for :body do %> -

<%= t 'notifier.note_comment_notification.greeting' %>

+

<%= t 'notifier.note_comment_notification.greeting' %>

- <% if @owner %> -

<%= raw t "notifier.note_comment_notification.#{@event}.your_note", :commenter => link_to_user(@commenter), :place => @place %>

- <% else %> -

<%= raw t "notifier.note_comment_notification.#{@event}.commented_note", :commenter => link_to_user(@commenter), :place => @place %>

- <% end %> +<% if @owner %> +

<%= raw t "notifier.note_comment_notification.#{@event}.your_note", :commenter => link_to_user(@commenter), :place => @place %>

+<% else %> +

<%= raw t "notifier.note_comment_notification.#{@event}.commented_note", :commenter => link_to_user(@commenter), :place => @place %>

+<% end %> - <%= render "notifier/user_message_table", :captured => capture { %> - <%= @comment.to_html %> - <% } %> +<%= render "notifier/user_message_table", :captured => capture { %> + <%= @comment.to_html %> +<% } %> -

<%= raw t 'notifier.note_comment_notification.details', :url => link_to(@noteurl, @noteurl) %>

-<% end %> +

<%= raw t 'notifier.note_comment_notification.details', :url => link_to(@noteurl, @noteurl) %>

diff --git a/app/views/notifier/signup_confirm.html.erb b/app/views/notifier/signup_confirm.html.erb index 6e7f7280e2..557fef8303 100644 --- a/app/views/notifier/signup_confirm.html.erb +++ b/app/views/notifier/signup_confirm.html.erb @@ -1,11 +1,9 @@ -<% content_for :body do %> -

<%= t("notifier.signup_confirm.greeting") %>

+

<%= t("notifier.signup_confirm.greeting") %>

-

<%= t("notifier.signup_confirm.created", :site_url => SERVER_URL) %>

+

<%= t("notifier.signup_confirm.created", :site_url => SERVER_URL) %>

-

<%= t("notifier.signup_confirm.confirm") %>

+

<%= t("notifier.signup_confirm.confirm") %>

-

<%= link_to @url, @url, :style => "white-space: nowrap" %>

+

<%= link_to @url, @url, :style => "white-space: nowrap" %>

-

<%= t("notifier.signup_confirm.welcome") %>

-<% end %> +

<%= t("notifier.signup_confirm.welcome") %>

From 433b7c5dfae0afa72058c2aaf236859998a2175a Mon Sep 17 00:00:00 2001 From: Herve Saint-Amand Date: Fri, 13 Jan 2017 22:58:57 +0000 Subject: [PATCH 29/42] Remove that ugly style="margin: 0" It's really only needed for rendering in Yahoo. Let's try to do without having to copy-paste that into every html template. --- app/views/layouts/notifier.html.erb | 2 +- app/views/notifier/changeset_comment_notification.html.erb | 2 +- app/views/notifier/diary_comment_notification.html.erb | 2 +- app/views/notifier/email_confirm.html.erb | 2 +- app/views/notifier/friend_notification.html.erb | 2 +- app/views/notifier/gpx_failure.html.erb | 2 +- app/views/notifier/gpx_success.html.erb | 2 +- app/views/notifier/lost_password.html.erb | 2 +- app/views/notifier/message_notification.html.erb | 2 +- app/views/notifier/note_comment_notification.html.erb | 2 +- app/views/notifier/signup_confirm.html.erb | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/app/views/layouts/notifier.html.erb b/app/views/layouts/notifier.html.erb index 3b8ce6657b..8122125cbf 100644 --- a/app/views/layouts/notifier.html.erb +++ b/app/views/layouts/notifier.html.erb @@ -24,7 +24,7 @@
- diff --git a/app/views/notifier/changeset_comment_notification.html.erb b/app/views/notifier/changeset_comment_notification.html.erb index 0d97b402a5..d0b04de3f1 100644 --- a/app/views/notifier/changeset_comment_notification.html.erb +++ b/app/views/notifier/changeset_comment_notification.html.erb @@ -1,4 +1,4 @@ -

+

<%= t'notifier.changeset_comment_notification.hi', :to_user => @to_user %>

diff --git a/app/views/notifier/diary_comment_notification.html.erb b/app/views/notifier/diary_comment_notification.html.erb index e37f682a33..4b7c631052 100644 --- a/app/views/notifier/diary_comment_notification.html.erb +++ b/app/views/notifier/diary_comment_notification.html.erb @@ -1,4 +1,4 @@ -

+

<%= t'notifier.diary_comment_notification.hi', :to_user => @to_user %>

diff --git a/app/views/notifier/email_confirm.html.erb b/app/views/notifier/email_confirm.html.erb index 2afbfcbf62..5d8f49d3dc 100644 --- a/app/views/notifier/email_confirm.html.erb +++ b/app/views/notifier/email_confirm.html.erb @@ -1,4 +1,4 @@ -

<%= t 'notifier.email_confirm_html.greeting' %>

+

<%= t 'notifier.email_confirm_html.greeting' %>

<%= t 'notifier.email_confirm_html.hopefully_you', :server_url => SERVER_URL, :new_address => @address %>

diff --git a/app/views/notifier/friend_notification.html.erb b/app/views/notifier/friend_notification.html.erb index 91de4b7320..356aca0aae 100644 --- a/app/views/notifier/friend_notification.html.erb +++ b/app/views/notifier/friend_notification.html.erb @@ -1,4 +1,4 @@ -

<%= t 'notifier.friend_notification.had_added_you', :user => @friend.befriender.display_name %>

+

<%= t 'notifier.friend_notification.had_added_you', :user => @friend.befriender.display_name %>

<%= render "notifier/user_message_table", :captured => capture { %>

<%= raw t 'notifier.friend_notification.see_their_profile', :userurl => link_to(@viewurl, @viewurl) %>

diff --git a/app/views/notifier/gpx_failure.html.erb b/app/views/notifier/gpx_failure.html.erb index cc43905b2a..dace185226 100644 --- a/app/views/notifier/gpx_failure.html.erb +++ b/app/views/notifier/gpx_failure.html.erb @@ -1,4 +1,4 @@ -

<%= t'notifier.gpx_notification.greeting' %>

+

<%= t'notifier.gpx_notification.greeting' %>

<%= render :partial => "gpx_description" %> diff --git a/app/views/notifier/gpx_success.html.erb b/app/views/notifier/gpx_success.html.erb index 8e24088456..d298bd70a0 100644 --- a/app/views/notifier/gpx_success.html.erb +++ b/app/views/notifier/gpx_success.html.erb @@ -1,4 +1,4 @@ -

<%= t'notifier.gpx_notification.greeting' %>

+

<%= t'notifier.gpx_notification.greeting' %>

<%= render :partial => "gpx_description" %> diff --git a/app/views/notifier/lost_password.html.erb b/app/views/notifier/lost_password.html.erb index 520d1097a2..5f1012ac6d 100644 --- a/app/views/notifier/lost_password.html.erb +++ b/app/views/notifier/lost_password.html.erb @@ -1,4 +1,4 @@ -

<%= t 'notifier.lost_password_html.greeting' %>

+

<%= t 'notifier.lost_password_html.greeting' %>

<%= t 'notifier.lost_password_html.hopefully_you' %>

diff --git a/app/views/notifier/message_notification.html.erb b/app/views/notifier/message_notification.html.erb index 7a4ac66a5a..d3871f0309 100644 --- a/app/views/notifier/message_notification.html.erb +++ b/app/views/notifier/message_notification.html.erb @@ -1,4 +1,4 @@ -

+

<%= t'notifier.message_notification.hi', :to_user => @to_user %>

diff --git a/app/views/notifier/note_comment_notification.html.erb b/app/views/notifier/note_comment_notification.html.erb index 88b8f9603d..7492985317 100644 --- a/app/views/notifier/note_comment_notification.html.erb +++ b/app/views/notifier/note_comment_notification.html.erb @@ -1,4 +1,4 @@ -

<%= t 'notifier.note_comment_notification.greeting' %>

+

<%= t 'notifier.note_comment_notification.greeting' %>

<% if @owner %>

<%= raw t "notifier.note_comment_notification.#{@event}.your_note", :commenter => link_to_user(@commenter), :place => @place %>

diff --git a/app/views/notifier/signup_confirm.html.erb b/app/views/notifier/signup_confirm.html.erb index 557fef8303..41b2ceb498 100644 --- a/app/views/notifier/signup_confirm.html.erb +++ b/app/views/notifier/signup_confirm.html.erb @@ -1,4 +1,4 @@ -

<%= t("notifier.signup_confirm.greeting") %>

+

<%= t("notifier.signup_confirm.greeting") %>

<%= t("notifier.signup_confirm.created", :site_url => SERVER_URL) %>

From a0627ec0c651cf33426438e26e4a4a2fe3a34fd5 Mon Sep 17 00:00:00 2001 From: Herve Saint-Amand Date: Sat, 14 Jan 2017 21:48:46 +0000 Subject: [PATCH 30/42] Revert "Added a greeting to the changeset comment message" This reverts commit 39c3fa427ea273e9011c380f9d2f2a9759cddb24. --- app/models/notifier.rb | 1 - app/views/notifier/changeset_comment_notification.html.erb | 4 ---- config/locales/ar.yml | 1 - config/locales/ast.yml | 1 - config/locales/be.yml | 1 - config/locales/bn.yml | 1 - config/locales/br.yml | 1 - config/locales/bs.yml | 1 - config/locales/ca.yml | 1 - config/locales/cs.yml | 1 - config/locales/da.yml | 1 - config/locales/de.yml | 1 - config/locales/el.yml | 1 - config/locales/en-GB.yml | 1 - config/locales/eo.yml | 1 - config/locales/es.yml | 1 - config/locales/et.yml | 1 - config/locales/eu.yml | 1 - config/locales/fa.yml | 1 - config/locales/fi.yml | 1 - config/locales/fr.yml | 1 - config/locales/gd.yml | 1 - config/locales/gl.yml | 1 - config/locales/he.yml | 1 - config/locales/hsb.yml | 1 - config/locales/hu.yml | 1 - config/locales/ia.yml | 1 - config/locales/id.yml | 1 - config/locales/is.yml | 1 - config/locales/it.yml | 1 - config/locales/ja.yml | 1 - config/locales/ko.yml | 1 - config/locales/lb.yml | 1 - config/locales/lt.yml | 1 - config/locales/lv.yml | 1 - config/locales/mk.yml | 1 - config/locales/ms.yml | 1 - config/locales/nb.yml | 1 - config/locales/nl.yml | 1 - config/locales/oc.yml | 1 - config/locales/pl.yml | 1 - config/locales/pt-BR.yml | 1 - config/locales/pt-PT.yml | 1 - config/locales/pt.yml | 1 - config/locales/ro.yml | 1 - config/locales/ru.yml | 1 - config/locales/scn.yml | 1 - config/locales/sk.yml | 1 - config/locales/sl.yml | 1 - config/locales/sq.yml | 1 - config/locales/sr.yml | 1 - config/locales/sv.yml | 1 - config/locales/tr.yml | 1 - config/locales/uk.yml | 1 - config/locales/vi.yml | 1 - config/locales/zh-CN.yml | 1 - config/locales/zh-TW.yml | 1 - 57 files changed, 60 deletions(-) diff --git a/app/models/notifier.rb b/app/models/notifier.rb index 7878c601ce..1de8651208 100644 --- a/app/models/notifier.rb +++ b/app/models/notifier.rb @@ -166,7 +166,6 @@ def note_comment_notification(comment, recipient) def changeset_comment_notification(comment, recipient) with_recipient_locale recipient do - @to_user = recipient.display_name @changeset_url = changeset_url(comment.changeset, :host => SERVER_URL) @comment = comment.body @owner = recipient == comment.changeset.user diff --git a/app/views/notifier/changeset_comment_notification.html.erb b/app/views/notifier/changeset_comment_notification.html.erb index d0b04de3f1..cb2748f4ac 100644 --- a/app/views/notifier/changeset_comment_notification.html.erb +++ b/app/views/notifier/changeset_comment_notification.html.erb @@ -1,7 +1,3 @@ -

- <%= t'notifier.changeset_comment_notification.hi', :to_user => @to_user %> -

-

<% if @owner %> <%= raw t "notifier.changeset_comment_notification.commented.your_changeset", :commenter => link_to_user(@commenter), :time => @time %> diff --git a/config/locales/ar.yml b/config/locales/ar.yml index 48ca27b7e1..c774111ff3 100644 --- a/config/locales/ar.yml +++ b/config/locales/ar.yml @@ -1170,7 +1170,6 @@ ar: بالقرب من %{place}. details: يمكن العثور على مزيد من التفاصيل حول هذه الملاحظة في %{url}. changeset_comment_notification: - hi: مرحبًا %{to_user}، greeting: مرحبا ، commented: partial_changeset_with_comment: مع تعليق '%{changeset_comment}' diff --git a/config/locales/ast.yml b/config/locales/ast.yml index 98d2d428d6..7940db1629 100644 --- a/config/locales/ast.yml +++ b/config/locales/ast.yml @@ -1308,7 +1308,6 @@ ast: La nota ta cerca de %{place}.' details: Pue alcontrar más detalles sobro la nota en %{url}. changeset_comment_notification: - hi: Bones %{to_user}, greeting: Bones, commented: subject_own: '[OpenStreetMap] %{commenter} comentó unu de los tos conxuntos diff --git a/config/locales/be.yml b/config/locales/be.yml index 3b3ba0be7f..f9619c73eb 100644 --- a/config/locales/be.yml +++ b/config/locales/be.yml @@ -1325,7 +1325,6 @@ be: Заўвага каля %{place}.' details: Больш падрабязна пра ўвагу можна прачытаць на %{url}. changeset_comment_notification: - hi: Прывітанне, %{to_user}, greeting: Прывітанне, commented: subject_own: '[OpenStreetMap] %{commenter} пракаментаваў адзін з вашых набораў diff --git a/config/locales/bn.yml b/config/locales/bn.yml index c83d0df5ad..29d6c62fa6 100644 --- a/config/locales/bn.yml +++ b/config/locales/bn.yml @@ -991,7 +991,6 @@ bn: greeting: হাই, details: টীকাটি সম্পর্কে আরও বিস্তারিত %{url|এখানে} পাওয়া যাবে। changeset_comment_notification: - hi: হাই %{to_user}, greeting: হাই, details: পরিবর্তনধার্য সম্পর্কে আরও বিস্তারিত %{url|এখানে} পাওয়া যাবে। message: diff --git a/config/locales/br.yml b/config/locales/br.yml index 6a30af50cd..fdbe41dbb0 100644 --- a/config/locales/br.yml +++ b/config/locales/br.yml @@ -1320,7 +1320,6 @@ br: hoc''h eus addispleget. Emañ an notenn tost da %{place}.' details: Munudoù ouzhpenn diwar-benn an notenn a c'hall bezañ kavet e %{url}. changeset_comment_notification: - hi: Demat %{to_user}, greeting: Demat, commented: subject_own: '[OpenStreetMap] %{commenter} en deus addispleget unan eus ho diff --git a/config/locales/bs.yml b/config/locales/bs.yml index f85c5a4430..81e353f26f 100644 --- a/config/locales/bs.yml +++ b/config/locales/bs.yml @@ -1045,7 +1045,6 @@ bs: subject_own: '[OpenStreetMap] %{commenter} je dao komentar na jednu od tvojih bilješki.' changeset_comment_notification: - hi: Zdravo %{to_user}, greeting: Zdravo, message: inbox: diff --git a/config/locales/ca.yml b/config/locales/ca.yml index 6ed262c374..171fd03c53 100644 --- a/config/locales/ca.yml +++ b/config/locales/ca.yml @@ -1363,7 +1363,6 @@ ca: heu comentat. La nota és a prop de %{place}.' details: Podeu trobar més detalls de la nota a %{url}. changeset_comment_notification: - hi: Hola %{to_user}, greeting: Hola, commented: subject_own: '[OpenStreetMap] %{commenter} ha comentat en un dels vostres diff --git a/config/locales/cs.yml b/config/locales/cs.yml index dfce4f3e04..f9e2aae62e 100644 --- a/config/locales/cs.yml +++ b/config/locales/cs.yml @@ -1326,7 +1326,6 @@ cs: Poznámka je umístěna poblíž %{place}.' details: Podrobnosti k poznámce můžete najít na %{url}. changeset_comment_notification: - hi: Dobrý den, uživateli %{to_user}, greeting: Ahoj, commented: subject_own: '[OpenStreetMap] %{commenter} okomentoval jednu z vašich sad diff --git a/config/locales/da.yml b/config/locales/da.yml index cce7d63811..7fc38de1ff 100644 --- a/config/locales/da.yml +++ b/config/locales/da.yml @@ -1351,7 +1351,6 @@ da: Bemærkningen er i nærheden af %{place}.' details: Flere oplysninger om bemærkningen kan findes på %{url}. changeset_comment_notification: - hi: Hej %{to_user}, greeting: Hej, commented: subject_own: '[OpenStreetMap] %{commenter} har kommenteret på et af dine ændringssæt' diff --git a/config/locales/de.yml b/config/locales/de.yml index 01a3e203a1..107480c24f 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -1395,7 +1395,6 @@ de: den du kommentiert hattest, reaktivert.' details: Weitere Details über den Hinweis findest du unter %{url}. changeset_comment_notification: - hi: Hallo %{to_user}, greeting: Hallo, commented: subject_own: '[OpenStreetMap] %{commenter} hat einen deiner Änderungssätze diff --git a/config/locales/el.yml b/config/locales/el.yml index b4f5fc9177..4af67e6375 100644 --- a/config/locales/el.yml +++ b/config/locales/el.yml @@ -1372,7 +1372,6 @@ el: details: Περισσότερες λεπτομέρειες σχετικά με τη σημείωση μπορούν να βρεθούν στο %{url}. changeset_comment_notification: - hi: Γεια σας %{to_user}, greeting: Γεια, commented: subject_own: '[OpenStreetMap] {{GENDER:%{commenter}|Ο|Η}} %{commenter} σχολίασε diff --git a/config/locales/en-GB.yml b/config/locales/en-GB.yml index 2334c29126..4b0ccd15e3 100644 --- a/config/locales/en-GB.yml +++ b/config/locales/en-GB.yml @@ -1341,7 +1341,6 @@ en-GB: on. The note is near %{place}.' details: More details about the note can be found at %{url}. changeset_comment_notification: - hi: Hi %{to_user}, greeting: Hi, commented: subject_own: '[OpenStreetMap] %{commenter} has commented on one of your changesets' diff --git a/config/locales/eo.yml b/config/locales/eo.yml index a194645117..f109b20edc 100644 --- a/config/locales/eo.yml +++ b/config/locales/eo.yml @@ -1310,7 +1310,6 @@ eo: La rimarko troviĝis ĉe %{place}.' details: Pli da detaloj pri la rimarko, vi povas trovi je %{url}. changeset_comment_notification: - hi: Saluton %{to_user}, greeting: Saluton, commented: subject_own: '[OpenStreetMap] %{commenter} komentis vian ŝanĝaron' diff --git a/config/locales/es.yml b/config/locales/es.yml index 3af24d8422..93c089948e 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -1351,7 +1351,6 @@ es: ha comentado. La nota está cerca de %{place}.' details: Más detalles acerca de la nota pueden encontrarse en %{url}. changeset_comment_notification: - hi: Hola %{to_user}, greeting: Hola, commented: subject_own: '[OpenStreetMap] %{commenter} ha comentado en uno de tus conjuntos diff --git a/config/locales/et.yml b/config/locales/et.yml index 71497c71dd..9d8dd5f129 100644 --- a/config/locales/et.yml +++ b/config/locales/et.yml @@ -1192,7 +1192,6 @@ et: Märkus on %{place} lähedal.' details: Märkuse lisateavet leiad %{url}. changeset_comment_notification: - hi: Tere, %{to_user}! greeting: Tere! commented: subject_own: '[OpenStreetMap] %{commenter} on kommenteerinud üht sinu muudatuskogumit' diff --git a/config/locales/eu.yml b/config/locales/eu.yml index 463c2bfa3d..e1d16c363c 100644 --- a/config/locales/eu.yml +++ b/config/locales/eu.yml @@ -753,7 +753,6 @@ eu: anonymous: Erabiltzale anonimoa greeting: Kaixo, changeset_comment_notification: - hi: Kaixo %{to_user}, greeting: Kaixo, message: inbox: diff --git a/config/locales/fa.yml b/config/locales/fa.yml index fb8e3d9e5a..9ba591beb5 100644 --- a/config/locales/fa.yml +++ b/config/locales/fa.yml @@ -1321,7 +1321,6 @@ fa: اید را دوباره فعال کرد. یادداشت نزدیک %{place} است.' details: اطلاعات بیشتر درباره ی یادداشت در %{url} یافت می‌شود. changeset_comment_notification: - hi: سلام %{to_user} ، greeting: سلام ، commented: your_changeset: '%{commenter} برای جعبه تغییر ایجاد شده توسط شما در %{time} diff --git a/config/locales/fi.yml b/config/locales/fi.yml index acade9d8d1..f5f263be40 100644 --- a/config/locales/fi.yml +++ b/config/locales/fi.yml @@ -1333,7 +1333,6 @@ fi: on lähellä paikkaa %{place}.' details: Lisää tietoja merkinnästä löytyy osoitteesta %{url}. changeset_comment_notification: - hi: Hei %{to_user}, greeting: Hei, commented: partial_changeset_without_comment: ei kommenttia diff --git a/config/locales/fr.yml b/config/locales/fr.yml index c63ccd7aac..0e9663e1ce 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -1382,7 +1382,6 @@ fr: La note se trouve près de %{place}.' details: Plus de détails concernant la note se trouvent à %{url}. changeset_comment_notification: - hi: Bonjour %{to_user}, greeting: Bonjour, commented: subject_own: '[OpenStreetMap] %{commenter} a commenté un de vos ensembles diff --git a/config/locales/gd.yml b/config/locales/gd.yml index 540bd5e0c3..66985cb22e 100644 --- a/config/locales/gd.yml +++ b/config/locales/gd.yml @@ -1331,7 +1331,6 @@ gd: a thug thu beachd air. Tha an nòta faisg air %{place}.' details: Gheibh thu barrachd fiosrachaidh air an nòta air %{url}. changeset_comment_notification: - hi: Shin thu, %{to_user}, greeting: Shin thu, commented: subject_own: '[OpenStreetMap] Thug %{commenter} beachd air seata atharraichean diff --git a/config/locales/gl.yml b/config/locales/gl.yml index 609b6d6ea5..65eaae6e80 100644 --- a/config/locales/gl.yml +++ b/config/locales/gl.yml @@ -1342,7 +1342,6 @@ gl: vostede comentou. A nota está preto de %{place}.' details: Pode atopar máis detalles da nota en %{url}. changeset_comment_notification: - hi: 'Ola %{to_user}:' greeting: Ola, commented: subject_own: '[OpenStreetMap] %{commenter} comentou nun dos teus conxuntos diff --git a/config/locales/he.yml b/config/locales/he.yml index c7fd3e0284..cdf75890c1 100644 --- a/config/locales/he.yml +++ b/config/locales/he.yml @@ -1325,7 +1325,6 @@ he: היא ליד %{place}. details: אפשר למצוא פרטים נוספים על ההערה בכתובת %{url} changeset_comment_notification: - hi: שלום %{to_user}, greeting: שלום, commented: subject_own: '[OpenStreetMap] המשתמש %{commenter} העיר על אחד מערכות השינויים diff --git a/config/locales/hsb.yml b/config/locales/hsb.yml index 4b61eb8b7d..204819de03 100644 --- a/config/locales/hsb.yml +++ b/config/locales/hsb.yml @@ -1300,7 +1300,6 @@ hsb: komentował. Pokazka je blisko %{place}.' details: Dalše podrobnosće wo pokazce móžeš pod %{url} namakać. changeset_comment_notification: - hi: Witaj %{to_user}, greeting: Witaj, commented: subject_own: '[OpenStreetMap] %{commenter} je jednu z twojich změnow komentował(a)' diff --git a/config/locales/hu.yml b/config/locales/hu.yml index 58b90166d6..b221b0f6cd 100644 --- a/config/locales/hu.yml +++ b/config/locales/hu.yml @@ -1286,7 +1286,6 @@ hu: amelyhez te is hozzászóltál, %{place} közelében.' details: 'A jegyzetről további információk: %{url}.' changeset_comment_notification: - hi: Szia %{to_user}! greeting: Szia! commented: subject_own: '[OpenStreetMap] %{commenter} hozzászólt az egyik változtatáscsomagodhoz' diff --git a/config/locales/ia.yml b/config/locales/ia.yml index 785cba61b6..6dddc7286d 100644 --- a/config/locales/ia.yml +++ b/config/locales/ia.yml @@ -1324,7 +1324,6 @@ ia: Le nota es in le vicinitate de %{place}.' details: Plus detalios sur le nota pote esser trovate a %{url}. changeset_comment_notification: - hi: Salute %{to_user}, greeting: Salute, commented: subject_own: '[OpenStreetMap] %{commenter} ha commentate un de tu gruppos diff --git a/config/locales/id.yml b/config/locales/id.yml index 53489e24b2..87fa9c86bd 100644 --- a/config/locales/id.yml +++ b/config/locales/id.yml @@ -1354,7 +1354,6 @@ id: yang Anda komentari. Catatan ini dekat %{place}.' details: Rincian lebih lanjut mengenai catatan dapat ditemukan di %{url}. changeset_comment_notification: - hi: Halo %{to_user}, greeting: Halo, commented: subject_own: '[OpenStreetMap] %{commenter} mengomentari salah satu perubahan diff --git a/config/locales/is.yml b/config/locales/is.yml index 17edb35b9a..a8d1323d01 100644 --- a/config/locales/is.yml +++ b/config/locales/is.yml @@ -981,7 +981,6 @@ is: anonymous: Nafnlaus notandi greeting: Hæ, changeset_comment_notification: - hi: Hæ %{to_user}, greeting: Hæ, message: inbox: diff --git a/config/locales/it.yml b/config/locales/it.yml index bc4aa320e4..22b1782dbe 100644 --- a/config/locales/it.yml +++ b/config/locales/it.yml @@ -1363,7 +1363,6 @@ it: La nota si trova vicino a %{place}.' details: Ulteriori dettagli sulla nota possono essere trovati su %{url}. changeset_comment_notification: - hi: Salve %{to_user}, greeting: Ciao, commented: subject_own: '[OpenStreetMap] %{commenter} ha commentato uno dei tuoi changeset' diff --git a/config/locales/ja.yml b/config/locales/ja.yml index eb5698faf3..d58cbc734e 100644 --- a/config/locales/ja.yml +++ b/config/locales/ja.yml @@ -1210,7 +1210,6 @@ ja: commented_note: '%{commenter}さんが、%{place}付近にあるあなたがコメントした地図メモを再開しました。' details: メモについての詳細は %{url} を参照。 changeset_comment_notification: - hi: こんにちは、%{to_user} さん。 greeting: こんにちは、 commented: partial_changeset_without_comment: コメントなし diff --git a/config/locales/ko.yml b/config/locales/ko.yml index cd69b11ba4..6bb87ee2f5 100644 --- a/config/locales/ko.yml +++ b/config/locales/ko.yml @@ -1311,7 +1311,6 @@ ko: 근처에 있습니다.' details: 참고에 대한 자세한 사항은 %{url}에서 찾을 수 있습니다. changeset_comment_notification: - hi: 안녕하세요 %{to_user}님, greeting: 안녕하세요, commented: subject_own: '[OpenStreetMap] %{commenter}님이 당신의 바뀜집합 중 하나에 댓글을 남겼습니다' diff --git a/config/locales/lb.yml b/config/locales/lb.yml index ce700c9699..e5f51d08a3 100644 --- a/config/locales/lb.yml +++ b/config/locales/lb.yml @@ -697,7 +697,6 @@ lb: greeting: Salut, details: Méi Detailer iwwer d'Notiz fannt Dir op %{url}. changeset_comment_notification: - hi: Salut %{to_user}, greeting: Salut, message: inbox: diff --git a/config/locales/lt.yml b/config/locales/lt.yml index 5134dbeeff..6aefd05b8a 100644 --- a/config/locales/lt.yml +++ b/config/locales/lt.yml @@ -1319,7 +1319,6 @@ lt: Pastaba yra netoli %{place}.' details: Daugiau informacijos apie pastabą galima rasti %{url}. changeset_comment_notification: - hi: Sveiki, %{to_user}, greeting: Labas, commented: subject_own: '[OpenStreetMap] %{commenter} pakomentavo vieną iš jūsų pakeitimų' diff --git a/config/locales/lv.yml b/config/locales/lv.yml index e4576d7be2..713d270e82 100644 --- a/config/locales/lv.yml +++ b/config/locales/lv.yml @@ -1326,7 +1326,6 @@ lv: kur esi komentējis. Piezīme ir netālu no %{place}.' details: Vairāk informācijas par piezīmēm var atrast %{url}. changeset_comment_notification: - hi: Sveiks %{to_user}, greeting: Sveicināti, commented: subject_own: '[OpenStreetMap] %{commenter} ir komentējis kādu no tavām izmaiņām' diff --git a/config/locales/mk.yml b/config/locales/mk.yml index a900848ad8..efee7dbd93 100644 --- a/config/locales/mk.yml +++ b/config/locales/mk.yml @@ -1331,7 +1331,6 @@ mk: Белешката се наоѓа близу %{place}.' details: Поподробно за белешката на %{url}. changeset_comment_notification: - hi: Здраво %{to_user}, greeting: Здраво, commented: subject_own: '[OpenStreetMap] %{commenter} искоментира на една од вашите промени' diff --git a/config/locales/ms.yml b/config/locales/ms.yml index 8d59b8b120..ecb0c7bcc3 100644 --- a/config/locales/ms.yml +++ b/config/locales/ms.yml @@ -1263,7 +1263,6 @@ ms: yang pernah anda ulas dekat %{place}.' details: Butiran lanjut tentang nota berkenaan boleh didapati di %{url}. changeset_comment_notification: - hi: Apa khabar %{to_user}, greeting: Apa khabar, commented: partial_changeset_with_comment: dengan komen '%{changeset_comment}' diff --git a/config/locales/nb.yml b/config/locales/nb.yml index cdbd4024a9..c6ee472f4c 100644 --- a/config/locales/nb.yml +++ b/config/locales/nb.yml @@ -1327,7 +1327,6 @@ nb: på. Merknaden er i nærheten av %{place}.' details: Flere opplysninger om merknaden finner du på %{url}. changeset_comment_notification: - hi: Hei %{to_user}, greeting: Hei, commented: subject_own: '[OpenStreetMap] %{commenter} har kommentert en av dine endringer' diff --git a/config/locales/nl.yml b/config/locales/nl.yml index a7d81f88bf..642a597113 100644 --- a/config/locales/nl.yml +++ b/config/locales/nl.yml @@ -1376,7 +1376,6 @@ nl: opnieuw geactiveerd. De opmerking is gemaakt bij %{place}.' details: Meer details over de opmerking zijn te vinden op %{url}. changeset_comment_notification: - hi: Hallo %{to_user}, greeting: Hallo, commented: subject_own: '[OpenStreetMap] %{commenter} heeft gereageerd op een van uw diff --git a/config/locales/oc.yml b/config/locales/oc.yml index 34a7a47254..158fc31400 100644 --- a/config/locales/oc.yml +++ b/config/locales/oc.yml @@ -1188,7 +1188,6 @@ oc: La nòta se tròba prèp de %{place}.' details: Mai de detalh sus la nòta pòt èsser obtengut a %{url}. changeset_comment_notification: - hi: Bonjorn %{to_user}, greeting: Bonjorn, commented: partial_changeset_with_comment: amb lo comentari '%{changeset_comment}' diff --git a/config/locales/pl.yml b/config/locales/pl.yml index 6e61cef172..33c76f1e40 100644 --- a/config/locales/pl.yml +++ b/config/locales/pl.yml @@ -1353,7 +1353,6 @@ pl: Znajduje się ona w położeniu %{place}. details: 'Więcej informacji na temat uwagi można znaleźć pod adresem: %{url}.' changeset_comment_notification: - hi: Witaj %{to_user}, greeting: Cześć, commented: subject_own: '[OpenStreetMap] %{commenter} skomentował jeden z twoich zestawów diff --git a/config/locales/pt-BR.yml b/config/locales/pt-BR.yml index c4170b3d4e..e80f896953 100644 --- a/config/locales/pt-BR.yml +++ b/config/locales/pt-BR.yml @@ -1366,7 +1366,6 @@ pt-BR: A nota está perto de %{place}.' details: Mais detalhes sobre a nota podem ser encontrados em %{url}. changeset_comment_notification: - hi: Olá %{to_user}, greeting: Olá, commented: subject_own: '[OpenStreetMap] %{commenter} comentou um conjunto de alterações diff --git a/config/locales/pt-PT.yml b/config/locales/pt-PT.yml index 34b65b2a40..8aaf8bc13f 100644 --- a/config/locales/pt-PT.yml +++ b/config/locales/pt-PT.yml @@ -1348,7 +1348,6 @@ pt-PT: O erro encontra-se perto de %{place}.' details: Ver mais detalhes sobre o erro reportado em %{url}. changeset_comment_notification: - hi: Olá %{to_user}, greeting: Olá, commented: subject_own: '[OpenStreetMap] %{commenter} comentou uma das suas edições' diff --git a/config/locales/pt.yml b/config/locales/pt.yml index c0965d2a1a..92da7e6fe3 100644 --- a/config/locales/pt.yml +++ b/config/locales/pt.yml @@ -1239,7 +1239,6 @@ pt: O erro encontra-se perto de %{place}.' details: Ver mais detalhes sobre o erro reportado em %{url}. changeset_comment_notification: - hi: Olá %{to_user}, greeting: Olá, message: inbox: diff --git a/config/locales/ro.yml b/config/locales/ro.yml index ceb35255b6..0b68f9c993 100644 --- a/config/locales/ro.yml +++ b/config/locales/ro.yml @@ -840,7 +840,6 @@ ro: note_comment_notification: greeting: Salut, changeset_comment_notification: - hi: Salut, %{to_user}, greeting: Salut, message: inbox: diff --git a/config/locales/ru.yml b/config/locales/ru.yml index 1ccb53349e..e1826e75ed 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -1369,7 +1369,6 @@ ru: Отметка недалеко от %{place}.' details: Подробнее о заметке %{url}. changeset_comment_notification: - hi: Привет, %{to_user}, greeting: Привет, commented: subject_own: '[OpenStreetMap] %{commenter} прокомментировал один из ваших diff --git a/config/locales/scn.yml b/config/locales/scn.yml index 9be1edbb46..695d3d29f4 100644 --- a/config/locales/scn.yml +++ b/config/locales/scn.yml @@ -1329,7 +1329,6 @@ scn: tu cummintasti. La nota s''attrova vicinu a %{place}.' details: Poi attruvari àutri dittagghî di sta nota nta %{url}. changeset_comment_notification: - hi: Salutamu %{to_user}, greeting: Salutamu, commented: subject_own: '[OpenStreetMap] %{commenter} cummintau unu dî tò gruppa di canciamenti' diff --git a/config/locales/sk.yml b/config/locales/sk.yml index fa563f920c..735effe7da 100644 --- a/config/locales/sk.yml +++ b/config/locales/sk.yml @@ -1155,7 +1155,6 @@ sk: greeting: Ahoj, details: Viac podrobností o poznámke môžete nájsť nájsť na %{url}. changeset_comment_notification: - hi: Ahoj %{to_user}, greeting: Ahoj, message: inbox: diff --git a/config/locales/sl.yml b/config/locales/sl.yml index a6281c97a4..dbfed4848e 100644 --- a/config/locales/sl.yml +++ b/config/locales/sl.yml @@ -1156,7 +1156,6 @@ sl: ki ste jo vi komentirali. Opomba je v bližini %{place}.' details: Več podrobnosti o opombi lahko najdete na %{url}. changeset_comment_notification: - hi: Pozdravljeni, %{to_user}, greeting: Pozdravljeni, commented: subject_own: '[OpenStreetMap] %{commenter} je komentiral enega izmed vaših diff --git a/config/locales/sq.yml b/config/locales/sq.yml index 12ba6693f9..dcc6e827b2 100644 --- a/config/locales/sq.yml +++ b/config/locales/sq.yml @@ -1052,7 +1052,6 @@ sq: note_comment_notification: greeting: Përshëndetje, changeset_comment_notification: - hi: Përshëndetje %{to_user}, greeting: Përshëndetje, commented: partial_changeset_without_comment: pa koment diff --git a/config/locales/sr.yml b/config/locales/sr.yml index a442348752..1d16679b22 100644 --- a/config/locales/sr.yml +++ b/config/locales/sr.yml @@ -1228,7 +1228,6 @@ sr: anonymous: Анонимни корисник greeting: Поздрав, changeset_comment_notification: - hi: Поздрав, %{to_user}, greeting: Поздрав, commented: partial_changeset_without_comment: без коментара diff --git a/config/locales/sv.yml b/config/locales/sv.yml index e2792d6084..f9ef716a11 100644 --- a/config/locales/sv.yml +++ b/config/locales/sv.yml @@ -1366,7 +1366,6 @@ sv: på. Noteringen är nära %{place}.' details: Mer detaljer om anteckningen finns på %{url}. changeset_comment_notification: - hi: Hej %{to_user}, greeting: Hej, commented: subject_own: '[OpenStreetMap] %{commenter} har kommenterat på en av dina ändringsset' diff --git a/config/locales/tr.yml b/config/locales/tr.yml index 0afaa5522e..4a8aec2ad5 100644 --- a/config/locales/tr.yml +++ b/config/locales/tr.yml @@ -1139,7 +1139,6 @@ tr: subject_own: '[OpenStreetMap] notlarından birisini %{commenter} tarafından yorumlandı' changeset_comment_notification: - hi: Merhaba %{to_user}, greeting: Merhaba, commented: partial_changeset_without_comment: yorumsuz diff --git a/config/locales/uk.yml b/config/locales/uk.yml index 4efe486280..8416e83d7f 100644 --- a/config/locales/uk.yml +++ b/config/locales/uk.yml @@ -1337,7 +1337,6 @@ uk: біля %{place}.' details: Докладніше про нотатку %{url}. changeset_comment_notification: - hi: Привіт, %{to_user}, greeting: Привіт, commented: subject_own: '[OpenStreetMap] %{commenter} прокоментував один з ваших наборів diff --git a/config/locales/vi.yml b/config/locales/vi.yml index b9751cedaf..5aeba831b1 100644 --- a/config/locales/vi.yml +++ b/config/locales/vi.yml @@ -1310,7 +1310,6 @@ vi: chú gần %{place}.' details: Xem chi tiết về ghi chú tại %{url}. changeset_comment_notification: - hi: Chào %{to_user}, greeting: Chào bạn, commented: subject_own: '[OpenStreetMap] %{commenter} đã bình luận về một bộ thay đổi diff --git a/config/locales/zh-CN.yml b/config/locales/zh-CN.yml index 39e035e21a..0f3a8d27d4 100644 --- a/config/locales/zh-CN.yml +++ b/config/locales/zh-CN.yml @@ -1225,7 +1225,6 @@ zh-CN: commented_note: '%{commenter} 重新激活了您感兴趣的一个地图笔记。该笔记位于 %{place} 附近。' details: 更多关于笔记的详细信息可以在%{url}找到。 changeset_comment_notification: - hi: 您好,%{to_user}: greeting: 您好, commented: subject_own: '[OpenStreetMap] %{commenter}在您的一个修改集合中做出了评论' diff --git a/config/locales/zh-TW.yml b/config/locales/zh-TW.yml index 3936da8fe9..70168f5126 100644 --- a/config/locales/zh-TW.yml +++ b/config/locales/zh-TW.yml @@ -1243,7 +1243,6 @@ zh-TW: commented_note: '%{commenter} 重新開啟了一個您曾評論的地圖註記。該註記位於 %{place} 附近。' details: 關於註記的更多詳細資料可在 %{url} 找到。 changeset_comment_notification: - hi: '%{to_user} 您好,' greeting: 您好, commented: subject_own: '[OpenStreetMap] %{commenter}% 在您的變更集評論' From 1e19e80d0e2420a1ca1951d364d4a95d159eceeb Mon Sep 17 00:00:00 2001 From: Herve Saint-Amand Date: Mon, 16 Jan 2017 21:13:52 +0000 Subject: [PATCH 31/42] Renamed @user_message_author to @author as suggested --- app/models/notifier.rb | 10 +++++----- app/views/notifier/_user_message_table.html.erb | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/models/notifier.rb b/app/models/notifier.rb index 1de8651208..8e386edf84 100644 --- a/app/models/notifier.rb +++ b/app/models/notifier.rb @@ -77,7 +77,7 @@ def message_notification(message) @replyurl = url_for(:host => SERVER_URL, :controller => "message", :action => "reply", :message_id => message.id) - @user_message_author = @from_user + @author = @from_user attach_user_avatar(message.sender) @@ -110,7 +110,7 @@ def diary_comment_notification(comment, recipient) :action => "new", :display_name => comment.user.display_name, :title => "Re: #{comment.diary_entry.title}") - @user_message_author = @from_user + @author = @from_user attach_user_avatar(comment.user) @@ -129,7 +129,7 @@ def friend_notification(friend) @friendurl = url_for(:host => SERVER_URL, :controller => "user", :action => "make_friend", :display_name => @friend.befriender.display_name) - @user_message_author = @friend.befriender.display_name + @author = @friend.befriender.display_name attach_user_avatar(@friend.befriender) mail :to => friend.befriendee.email, @@ -151,7 +151,7 @@ def note_comment_notification(comment, recipient) I18n.t("notifier.note_comment_notification.anonymous") end - @user_message_author = @commenter + @author = @commenter attach_user_avatar(comment.author) subject = if @owner @@ -173,7 +173,7 @@ def changeset_comment_notification(comment, recipient) @changeset_comment = comment.changeset.tags["comment"].presence @time = comment.created_at @changeset_author = comment.changeset.user.display_name - @user_message_author = @commenter + @author = @commenter subject = if @owner I18n.t("notifier.changeset_comment_notification.commented.subject_own", :commenter => @commenter) diff --git a/app/views/notifier/_user_message_table.html.erb b/app/views/notifier/_user_message_table.html.erb index 0a73001734..1b33e082b6 100644 --- a/app/views/notifier/_user_message_table.html.erb +++ b/app/views/notifier/_user_message_table.html.erb @@ -4,10 +4,10 @@ <%= link_to( image_tag( attachments["avatar.png"].url, - alt: @user_message_author, - title: @user_message_author + alt: @author, + title: @author ), - user_url(@user_message_author, :host => SERVER_URL), + user_url(@author, :host => SERVER_URL), :target => "_blank" ) %> From e5152c3931c8f0766b2201053427b398e3b13bde Mon Sep 17 00:00:00 2001 From: Herve Saint-Amand Date: Mon, 16 Jan 2017 21:21:55 +0000 Subject: [PATCH 32/42] Move attach_project_logo to be its own before_action filter, as suggested --- app/models/notifier.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/notifier.rb b/app/models/notifier.rb index 8e386edf84..0ed7071ac7 100644 --- a/app/models/notifier.rb +++ b/app/models/notifier.rb @@ -4,6 +4,7 @@ class Notifier < ActionMailer::Base :auto_submitted => "auto-generated" helper :application before_action :set_shared_template_vars + before_action :attach_project_logo def signup_confirm(user, token) with_recipient_locale user do @@ -191,7 +192,6 @@ def changeset_comment_notification(comment, recipient) def set_shared_template_vars @root_url = root_url(:host => SERVER_URL) - attach_project_logo end def attach_project_logo From e3e5ad4c5fed07eda993648f1998d9b0f5c78921 Mon Sep 17 00:00:00 2001 From: Herve Saint-Amand Date: Mon, 16 Jan 2017 22:50:01 +0000 Subject: [PATCH 33/42] Refactored the code to invoke the message body partial layout, as suggested in the PR --- app/helpers/notifier_helper.rb | 7 +++++++ ..._user_message_table.html.erb => _message_body.html.erb} | 2 +- app/views/notifier/changeset_comment_notification.html.erb | 4 ++-- app/views/notifier/diary_comment_notification.html.erb | 4 ++-- app/views/notifier/friend_notification.html.erb | 4 ++-- app/views/notifier/message_notification.html.erb | 4 ++-- app/views/notifier/note_comment_notification.html.erb | 4 ++-- 7 files changed, 18 insertions(+), 11 deletions(-) rename app/views/notifier/{_user_message_table.html.erb => _message_body.html.erb} (96%) diff --git a/app/helpers/notifier_helper.rb b/app/helpers/notifier_helper.rb index 62801ed823..0510ae0a89 100644 --- a/app/helpers/notifier_helper.rb +++ b/app/helpers/notifier_helper.rb @@ -11,4 +11,11 @@ def link_to_user(display_name) :style => "text-decoration: none; color: #222; font-weight: bold" ) end + + def message_body(&block) + render( + partial: "message_body", + locals: { body: capture(&block) } + ) + end end diff --git a/app/views/notifier/_user_message_table.html.erb b/app/views/notifier/_message_body.html.erb similarity index 96% rename from app/views/notifier/_user_message_table.html.erb rename to app/views/notifier/_message_body.html.erb index 1b33e082b6..29ecf9ea89 100644 --- a/app/views/notifier/_user_message_table.html.erb +++ b/app/views/notifier/_message_body.html.erb @@ -12,7 +12,7 @@ ) %>

+ <%= yield %>
- <%= captured %> + <%= body %>
diff --git a/app/views/notifier/changeset_comment_notification.html.erb b/app/views/notifier/changeset_comment_notification.html.erb index cb2748f4ac..bbcd0614eb 100644 --- a/app/views/notifier/changeset_comment_notification.html.erb +++ b/app/views/notifier/changeset_comment_notification.html.erb @@ -11,9 +11,9 @@ <% end %>

-<%= render "notifier/user_message_table", :captured => capture { %> +<%= message_body do %> <%= @comment.to_html %> -<% } %> +<% end %>

<%= raw t 'notifier.changeset_comment_notification.details', :url => content_tag("nobr", link_to(@changeset_url, @changeset_url)) %> diff --git a/app/views/notifier/diary_comment_notification.html.erb b/app/views/notifier/diary_comment_notification.html.erb index 4b7c631052..73bfe9a33d 100644 --- a/app/views/notifier/diary_comment_notification.html.erb +++ b/app/views/notifier/diary_comment_notification.html.erb @@ -5,9 +5,9 @@ <%= raw t'notifier.diary_comment_notification.header', :from_user => link_to_user(@from_user), :subject => content_tag("em", @title) %>

-<%= render "notifier/user_message_table", :captured => capture { %> +<%= message_body do %> <%= @text.to_html %> -<% } %> +<% end %> <% content_for :footer do %>

<%= raw t'notifier.diary_comment_notification.footer', diff --git a/app/views/notifier/friend_notification.html.erb b/app/views/notifier/friend_notification.html.erb index 356aca0aae..cfea971958 100644 --- a/app/views/notifier/friend_notification.html.erb +++ b/app/views/notifier/friend_notification.html.erb @@ -1,9 +1,9 @@

<%= t 'notifier.friend_notification.had_added_you', :user => @friend.befriender.display_name %>

-<%= render "notifier/user_message_table", :captured => capture { %> +<%= message_body do %>

<%= raw t 'notifier.friend_notification.see_their_profile', :userurl => link_to(@viewurl, @viewurl) %>

<% unless @friend.befriendee.is_friends_with?(@friend.befriender) -%>

<%= raw t 'notifier.friend_notification.befriend_them', :befriendurl => link_to(@friendurl, @friendurl) %>

<% end -%> -<% } %> +<% end %> diff --git a/app/views/notifier/message_notification.html.erb b/app/views/notifier/message_notification.html.erb index d3871f0309..97a352a499 100644 --- a/app/views/notifier/message_notification.html.erb +++ b/app/views/notifier/message_notification.html.erb @@ -8,9 +8,9 @@ %>

-<%= render "notifier/user_message_table", :captured => capture { %> +<%= message_body do %> <%= @text.to_html %> -<% } %> +<% end %> <% content_for :footer do %>

diff --git a/app/views/notifier/note_comment_notification.html.erb b/app/views/notifier/note_comment_notification.html.erb index 7492985317..ecaff81dc5 100644 --- a/app/views/notifier/note_comment_notification.html.erb +++ b/app/views/notifier/note_comment_notification.html.erb @@ -6,8 +6,8 @@

<%= raw t "notifier.note_comment_notification.#{@event}.commented_note", :commenter => link_to_user(@commenter), :place => @place %>

<% end %> -<%= render "notifier/user_message_table", :captured => capture { %> +<%= message_body do %> <%= @comment.to_html %> -<% } %> +<% end %>

<%= raw t 'notifier.note_comment_notification.details', :url => link_to(@noteurl, @noteurl) %>

From 1285c9f14bc190f3f574e5dd2f1d757783dccb60 Mon Sep 17 00:00:00 2001 From: Herve Saint-Amand Date: Mon, 16 Jan 2017 22:53:04 +0000 Subject: [PATCH 34/42] Convert those tags to CSS --- app/views/notifier/changeset_comment_notification.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/notifier/changeset_comment_notification.html.erb b/app/views/notifier/changeset_comment_notification.html.erb index bbcd0614eb..c2b552ed5e 100644 --- a/app/views/notifier/changeset_comment_notification.html.erb +++ b/app/views/notifier/changeset_comment_notification.html.erb @@ -16,11 +16,11 @@ <% end %>

- <%= raw t 'notifier.changeset_comment_notification.details', :url => content_tag("nobr", link_to(@changeset_url, @changeset_url)) %> + <%= raw t 'notifier.changeset_comment_notification.details', :url => link_to(@changeset_url, @changeset_url, :style => "white-space: nowrap") %>

<% content_for :footer do %>

- <%= raw t 'notifier.changeset_comment_notification.unsubscribe', :url => content_tag("nobr", link_to(@changeset_url, @changeset_url, :style => "color: #222")) %> + <%= raw t 'notifier.changeset_comment_notification.unsubscribe', :url => link_to(@changeset_url, @changeset_url, :style => "color: #222; white-space: nowrap") %>

<% end %> From 774e583b20555c4ad9f676a6321169ff3482980a Mon Sep 17 00:00:00 2001 From: Herve Saint-Amand Date: Mon, 16 Jan 2017 23:12:59 +0000 Subject: [PATCH 35/42] Rubocop says to use "hash rockets" Rubocop will have its way. --- app/helpers/notifier_helper.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/helpers/notifier_helper.rb b/app/helpers/notifier_helper.rb index 0510ae0a89..5889b6ff82 100644 --- a/app/helpers/notifier_helper.rb +++ b/app/helpers/notifier_helper.rb @@ -14,8 +14,8 @@ def link_to_user(display_name) def message_body(&block) render( - partial: "message_body", - locals: { body: capture(&block) } + :partial => "message_body", + :locals => { :body => capture(&block) } ) end end From 25d80789dda4d989f5b5e168ddd05a20d11c183b Mon Sep 17 00:00:00 2001 From: Herve Saint-Amand Date: Mon, 23 Jan 2017 22:26:34 +0000 Subject: [PATCH 36/42] Put the user avatar in a

block This improves rendering on those clients that set the margin to 0 on

blocks. --- app/views/notifier/_message_body.html.erb | 26 ++++++++++++++--------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/app/views/notifier/_message_body.html.erb b/app/views/notifier/_message_body.html.erb index 29ecf9ea89..a108643ceb 100644 --- a/app/views/notifier/_message_body.html.erb +++ b/app/views/notifier/_message_body.html.erb @@ -1,15 +1,21 @@ -
- <%= link_to( - image_tag( - attachments["avatar.png"].url, - alt: @author, - title: @author - ), - user_url(@author, :host => SERVER_URL), - :target => "_blank" - ) %> + + <%# Some email clients (e.g. Yahoo as of 2017-01) remove the margin + on

tags. Since the body itself always starts with a

, by + wrapping the image here in a

as well, we ensure that they will at + least always be aligned with each other. %> +

+ <%= link_to( + image_tag( + attachments["avatar.png"].url, + alt: @author, + title: @author + ), + user_url(@author, :host => SERVER_URL), + :target => "_blank" + ) %> +

<%= body %> From cf11913d586bf9c25f003f4acd3b114367fa4aa9 Mon Sep 17 00:00:00 2001 From: Herve Saint-Amand Date: Wed, 25 Jan 2017 22:50:52 +0000 Subject: [PATCH 37/42] Apply inline styling to all

tags Solved the problem of

tags being given different padding or color by different clients, without having to copy-paste a string of CSS into every

tag in the templates. --- app/helpers/notifier_helper.rb | 4 ++++ app/views/layouts/notifier.html.erb | 3 +-- app/views/notifier/_message_body.html.erb | 28 ++++++++++------------- 3 files changed, 17 insertions(+), 18 deletions(-) diff --git a/app/helpers/notifier_helper.rb b/app/helpers/notifier_helper.rb index 5889b6ff82..be01e5391a 100644 --- a/app/helpers/notifier_helper.rb +++ b/app/helpers/notifier_helper.rb @@ -18,4 +18,8 @@ def message_body(&block) :locals => { :body => capture(&block) } ) end + + def apply_inline_css(html) + html.gsub /

/, '

' + end end diff --git a/app/views/layouts/notifier.html.erb b/app/views/layouts/notifier.html.erb index 8122125cbf..8575424f23 100644 --- a/app/views/layouts/notifier.html.erb +++ b/app/views/layouts/notifier.html.erb @@ -1,6 +1,5 @@ - @@ -25,7 +24,7 @@
- <%= yield %> + <%= raw apply_inline_css(yield) %>
diff --git a/app/views/notifier/_message_body.html.erb b/app/views/notifier/_message_body.html.erb index a108643ceb..723bb84e5b 100644 --- a/app/views/notifier/_message_body.html.erb +++ b/app/views/notifier/_message_body.html.erb @@ -1,21 +1,17 @@ -
- <%# Some email clients (e.g. Yahoo as of 2017-01) remove the margin - on

tags. Since the body itself always starts with a

, by - wrapping the image here in a

as well, we ensure that they will at - least always be aligned with each other. %> -

- <%= link_to( - image_tag( - attachments["avatar.png"].url, - alt: @author, - title: @author - ), - user_url(@author, :host => SERVER_URL), - :target => "_blank" - ) %> -

+
+ <%= link_to( + image_tag( + attachments["avatar.png"].url, + alt: @author, + title: @author, + width: 50, + height: 50 + ), + user_url(@author, :host => SERVER_URL), + :target => "_blank" + ) %> <%= body %> From 1def88b5d2521649f244411c06b25790163843d1 Mon Sep 17 00:00:00 2001 From: Herve Saint-Amand Date: Wed, 25 Jan 2017 23:01:37 +0000 Subject: [PATCH 38/42] Left-align logo --- app/views/layouts/notifier.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/layouts/notifier.html.erb b/app/views/layouts/notifier.html.erb index 8575424f23..8287d5ec05 100644 --- a/app/views/layouts/notifier.html.erb +++ b/app/views/layouts/notifier.html.erb @@ -8,7 +8,7 @@ -
+ <%= image_tag attachments["logo.png"].url, alt: "OpenStreetMap logo", title: "OpenStreetMap", height: "30", width: "30", border: "0" %> From f83b719f0347931640475b9e5ee8d60bbc50fd6d Mon Sep 17 00:00:00 2001 From: Herve Saint-Amand Date: Fri, 27 Jan 2017 23:20:11 +0000 Subject: [PATCH 39/42] Set border=0 on that img IE9 shows a big nasty blue border on linked images if you don't specify border=0 --- app/views/notifier/_message_body.html.erb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/views/notifier/_message_body.html.erb b/app/views/notifier/_message_body.html.erb index 723bb84e5b..d86d44133e 100644 --- a/app/views/notifier/_message_body.html.erb +++ b/app/views/notifier/_message_body.html.erb @@ -1,4 +1,4 @@ - +
<%= link_to( @@ -7,7 +7,8 @@ alt: @author, title: @author, width: 50, - height: 50 + height: 50, + border: 0 ), user_url(@author, :host => SERVER_URL), :target => "_blank" From a371aad9ac2f177eee761e8c0bfb0d358796373f Mon Sep 17 00:00:00 2001 From: Herve Saint-Amand Date: Sat, 28 Jan 2017 23:08:25 +0000 Subject: [PATCH 40/42] Renamed `apply_inline_css` to `style_message` as suggested --- app/helpers/notifier_helper.rb | 2 +- app/views/layouts/notifier.html.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/helpers/notifier_helper.rb b/app/helpers/notifier_helper.rb index be01e5391a..3e53e2543c 100644 --- a/app/helpers/notifier_helper.rb +++ b/app/helpers/notifier_helper.rb @@ -19,7 +19,7 @@ def message_body(&block) ) end - def apply_inline_css(html) + def style_message(html) html.gsub /

/, '

' end end diff --git a/app/views/layouts/notifier.html.erb b/app/views/layouts/notifier.html.erb index 8287d5ec05..dd041cca52 100644 --- a/app/views/layouts/notifier.html.erb +++ b/app/views/layouts/notifier.html.erb @@ -24,7 +24,7 @@
- <%= raw apply_inline_css(yield) %> + <%= raw style_message(yield) %>
From 74e28f8bd096cd9a00e96072a83bfef14cf10525 Mon Sep 17 00:00:00 2001 From: Herve Saint-Amand Date: Sat, 28 Jan 2017 23:27:04 +0000 Subject: [PATCH 41/42] Use each_with_object and make the code pithier --- test/test_helper.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/test/test_helper.rb b/test/test_helper.rb index 68b4a5018f..52d11027f8 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -187,15 +187,13 @@ def stub_hostip_requests end def email_text_parts(message) - text_parts = [] - message.parts.each do |part| + message.parts.each_with_object([]) do |part, text_parts| if part.content_type.start_with?("text/") text_parts.push(part) elsif part.multipart? text_parts.concat(email_text_parts(part)) end end - text_parts end end end From 223a12caf847664fc86e0882597857d0b3c81e4e Mon Sep 17 00:00:00 2001 From: Herve Saint-Amand Date: Sat, 28 Jan 2017 23:29:44 +0000 Subject: [PATCH 42/42] That new message in the HTML version of the mail should also be added to the plain text version of the mail Duh. --- app/views/notifier/changeset_comment_notification.text.erb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/views/notifier/changeset_comment_notification.text.erb b/app/views/notifier/changeset_comment_notification.text.erb index 44a3c12161..5da6feddcb 100644 --- a/app/views/notifier/changeset_comment_notification.text.erb +++ b/app/views/notifier/changeset_comment_notification.text.erb @@ -16,3 +16,5 @@ == <%= t 'notifier.changeset_comment_notification.details', :url => @changeset_url %> + +<%= t 'notifier.changeset_comment_notification.unsubscribe', :url => @changeset_url %>