attributes[:author_name] = name + " (a)"
end
- note.comments.create(attributes, :without_protection => true)
+ comment = note.comments.create(attributes, :without_protection => true)
note.comments.map { |c| c.author }.uniq.each do |user|
if user and user != @user
- Notifier.deliver_note_comment_notification(comment, user)
+ Notifier.note_comment_notification(comment, user).deliver
end
end
end
end
def note_comment_notification(comment, recipient)
- common_headers recipient
- owner = (recipient == comment.note.author);
- subject I18n.t('notifier.note_plain.subject_own', :commenter => comment.author_name) if owner
- subject I18n.t('notifier.note_plain.subject_other', :commenter => comment.author_name) unless owner
-
- body :nodeurl => url_for(:host => SERVER_URL,
- :controller => "browse",
- :action => "note",
- :id => comment.note_id),
- :place => comment.note.nearby_place,
- :comment => comment.body,
- :owner => owner,
- :commenter => comment.author_name
+ @locale = recipient.preferred_language_from(I18n.available_locales)
+ @noteurl = browse_note_url(comment.note, :host => SERVER_URL)
+ @place = comment.note.nearby_place
+ @comment = RichText::Text.new(comment.body)
+ @owner = recipient == comment.note.author
+ @commenter = comment.author_name
+
+ subject = I18n.t('notifier.note_comment_notification.subject_own', :commenter => comment.author_name) if @owner
+ subject = I18n.t('notifier.note_comment_notification.subject_other', :commenter => comment.author_name) unless @owner
+
+ mail :to => recipient.email, :subject => subject
end
private
-<%= t 'notifier.note_plain.greeting' %>
+<p><%= t 'notifier.note_comment_notification.greeting' %></p>
<% if @owner %>
-<%= t 'notifier.note_plain.your_note', :commenter => @commenter, :place => @place %>
+<p><%= t 'notifier.note_comment_notification.your_note', :commenter => @commenter, :place => @place %></p>
<% else %>
-<%= t 'notifier.note_plain.commented_note', :commenter => @commenter, :place => @place %>
+<p><%= t 'notifier.note_comment_notification.commented_note', :commenter => @commenter, :place => @place %></p>
<% end %>
==
-<%= @comment %>
+<%= @comment.to_html %>
==
-<%= t 'notifier.note_plain.details', :URL => @noteurl %>
-
-
+<p><%= raw t 'notifier.note_comment_notification.details', :url => link_to(@noteurl, @noteurl) %></p>
--- /dev/null
+<%= t 'notifier.note_comment_notification.greeting' %>
+
+<% if @owner %>
+<%= t 'notifier.note_comment_notification.your_note', :commenter => @commenter, :place => @place %>
+<% else %>
+<%= t 'notifier.note_comment_notification.commented_note', :commenter => @commenter, :place => @place %>
+<% end %>
+
+==
+<%= @comment %>
+==
+
+<%= t 'notifier.note_comment_notification.details', :url => @noteurl %>
greeting: "Hi,"
hopefully_you: "Someone (possibly you) has asked for the password to be reset on this email address's openstreetmap.org account."
click_the_link: "If this is you, please click the link below to reset your password."
- note_plain:
+ note_comment_notification:
subject_own: "[OpenStreetMap] %{commenter} has commented on one of your notes"
subject_other: "[OpenStreetMap] %{commenter} has commented on a note you are interested in"
greeting: "Hi,"
your_note: "%{commenter} has left a comment on one of your map notes near %{place}."
commented_note: "%{commenter} has left a comment on a map note you have commented on. The note is near %{place}."
- details: "More details about the note can be found at %{URL}."
+ details: "More details about the note can be found at %{url}."
message:
inbox:
title: "Inbox"