From: Tom Hughes Date: Mon, 15 Oct 2012 21:34:55 +0000 (+0100) Subject: Return the body of a note comment as a rich text object X-Git-Tag: live~5099^2~77 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/654d22ed2e30f406d036cb57273678c4406f3535?ds=inline Return the body of a note comment as a rich text object --- diff --git a/app/models/note_comment.rb b/app/models/note_comment.rb index bcbcf79be..0500acb8b 100644 --- a/app/models/note_comment.rb +++ b/app/models/note_comment.rb @@ -18,4 +18,9 @@ class NoteComment < ActiveRecord::Base self.author.display_name end end + + # Return the comment text + def body + RichText.new("text", read_attribute(:body)) + end end diff --git a/app/models/notifier.rb b/app/models/notifier.rb index 5ec401d18..1107a0da6 100644 --- a/app/models/notifier.rb +++ b/app/models/notifier.rb @@ -118,7 +118,7 @@ class Notifier < ActionMailer::Base @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) + @comment =comment.body @owner = recipient == comment.note.author @commenter = comment.author_name diff --git a/app/views/notifier/note_comment_notification.text.erb b/app/views/notifier/note_comment_notification.text.erb index 7b4ccd384..81306f9cb 100644 --- a/app/views/notifier/note_comment_notification.text.erb +++ b/app/views/notifier/note_comment_notification.text.erb @@ -7,7 +7,7 @@ <% end %> == -<%= @comment %> +<%= @comment.to_text %> == <%= t 'notifier.note_comment_notification.details', :url => @noteurl %>