diff options
author | Louise Crow <louise.crow@gmail.com> | 2013-01-07 12:00:30 +0000 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2013-01-07 12:02:29 +0000 |
commit | 7506dd30d20a8c3d8f7535d2346292fb36337a8e (patch) | |
tree | 0bdd6baab0d91fa80d1bac18f440ecd9070ad2c9 | |
parent | 33b0b98f260b5666cff90db7a6bc8ef45696ad30 (diff) |
Handle case where info request doesn't have a user_name
-rw-r--r-- | app/models/incoming_message.rb | 1 | ||||
-rw-r--r-- | spec/models/incoming_message_spec.rb | 7 |
2 files changed, 8 insertions, 0 deletions
diff --git a/app/models/incoming_message.rb b/app/models/incoming_message.rb index 123319125..06fd94063 100644 --- a/app/models/incoming_message.rb +++ b/app/models/incoming_message.rb @@ -347,6 +347,7 @@ class IncomingMessage < ActiveRecord::Base # Lotus notes quoting yeuch! def remove_lotus_quoting(text, replacement = "FOLDED_QUOTED_SECTION") text = text.dup + return text if self.info_request.user_name.nil? name = Regexp.escape(self.info_request.user_name) # To end of message sections diff --git a/spec/models/incoming_message_spec.rb b/spec/models/incoming_message_spec.rb index fdbcd1e23..42e85633a 100644 --- a/spec/models/incoming_message_spec.rb +++ b/spec/models/incoming_message_spec.rb @@ -166,6 +166,13 @@ describe IncomingMessage, " folding quoted parts of emails" do @incoming_message.remove_lotus_quoting(text).should match(/FOLDED_QUOTED_SECTION/) end + it 'should not error when trying to fold lotus notes quoted parts on a request with no user_name' do + text = "hello" + @incoming_message = IncomingMessage.new() + @incoming_message.stub_chain(:info_request, :user_name).and_return(nil) + @incoming_message.remove_lotus_quoting(text).should == 'hello' + end + it "cope with [ in user names properly" do @incoming_message = IncomingMessage.new() @incoming_message.stub_chain(:info_request, :user_name).and_return("Sir [ Bobble") |