aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLouise Crow <louise.crow@gmail.com>2012-10-11 15:13:26 +0100
committerLouise Crow <louise.crow@gmail.com>2012-10-11 15:13:26 +0100
commita902a8308fe05e9fd7a61aa8378aaf95729fcc88 (patch)
tree6140f28722bc1f9887f92bdfa38b835c2a759ac1
parent6833362f1805897df3684f872cc562d804df2422 (diff)
Fix the spec by making the regexp match text converted from HTML (we're now choosing HTML parts of mails in preference to plain text), and by correcting bug in parameter passing.
-rw-r--r--app/models/incoming_message.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/app/models/incoming_message.rb b/app/models/incoming_message.rb
index c0fe8e52a..367909f57 100644
--- a/app/models/incoming_message.rb
+++ b/app/models/incoming_message.rb
@@ -344,7 +344,7 @@ class IncomingMessage < ActiveRecord::Base
name = Regexp.escape(self.info_request.user_name)
# To end of message sections
- text.gsub!(/^#{name}[^\n]+\nSent by:[^\n]+\n.*/ims, "\n\n" + replacement)
+ text.gsub!(/^\s?#{name}[^\n]+\n([^\n]+\n)?\s?Sent by:[^\n]+\n.*/ims, "\n\n" + replacement)
# Some other sort of forwarding quoting
# http://www.whatdotheyknow.com/request/224/response/326
@@ -578,7 +578,8 @@ class IncomingMessage < ActiveRecord::Base
# Remove existing quoted sections
folded_quoted_text = self.remove_lotus_quoting(text, 'FOLDED_QUOTED_SECTION')
- folded_quoted_text = IncomingMessage.remove_quoted_sections(text, "FOLDED_QUOTED_SECTION")
+ folded_quoted_text = IncomingMessage.remove_quoted_sections(folded_quoted_text, "FOLDED_QUOTED_SECTION")
+
self.cached_main_body_text_unfolded = text
self.cached_main_body_text_folded = folded_quoted_text
self.save!