From 654d22ed2e30f406d036cb57273678c4406f3535 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Mon, 15 Oct 2012 22:34:55 +0100 Subject: [PATCH] Return the body of a note comment as a rich text object --- app/models/note_comment.rb | 5 +++++ app/models/notifier.rb | 2 +- app/views/notifier/note_comment_notification.text.erb | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) 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 %> -- 2.43.2