Fix for multiple paragraph emails with text em-dashes in them (--).

This commit is contained in:
Robin Ward 2013-06-25 14:05:14 -04:00
parent 87db582297
commit 9a19c0d9c4
4 changed files with 67 additions and 3 deletions

View File

@ -29,7 +29,7 @@ gem 'fog', require: false
gem 'has_ip_address'
gem 'hiredis'
gem 'email_reply_parser'
gem 'email_reply_parser', git: 'https://github.com/lawrencepit/email_reply_parser.git'
# note: for image_optim to correctly work you need
# sudo apt-get install -y advancecomp gifsicle jpegoptim libjpeg-progs optipng pngcrush

View File

@ -53,6 +53,12 @@ GIT
multi_json
omniauth (~> 1.0)
GIT
remote: https://github.com/lawrencepit/email_reply_parser.git
revision: 67408dfb1b99fb8d5f145f782b9e22d1851a8e5a
specs:
email_reply_parser (0.6)
GIT
remote: https://github.com/rails-api/active_model_serializers.git
revision: fe84e0ad5268f1439123fd9a1f9fd12e25a54cd3
@ -158,7 +164,6 @@ GEM
diffy (2.1.4)
em-redis (0.3.0)
eventmachine
email_reply_parser (0.5.3)
ember-rails (0.10.0)
active_model_serializers
barber
@ -470,7 +475,7 @@ DEPENDENCIES
discourse_emoji!
discourse_plugin!
em-redis
email_reply_parser
email_reply_parser!
ember-rails
ember-source (= 1.0.0.rc5)
eventmachine

View File

@ -40,6 +40,23 @@ stripped from my reply?")
end
end
describe "multiple paragraphs" do
let(:paragraphs) { File.read("#{Rails.root}/spec/fixtures/emails/paragraphs.eml") }
let(:receiver) { Email::Receiver.new(paragraphs) }
it "does something" do
receiver.process
expect(receiver.body).to eq(
"Is there any reason the *old* candy can't be be kept in silos while the new candy
is imported into *new* silos?
The thing about candy is it stays delicious for a long time -- we can just keep
it there without worrying about it too much, imo.
Thanks for listening.")
end
end
describe "with a valid email" do
let(:reply_key) { "59d8df8370b7e95c5a49fbf86aeb2c93" }
let(:valid_reply) { File.read("#{Rails.root}/spec/fixtures/emails/valid_reply.eml") }

42
spec/fixtures/emails/paragraphs.eml vendored Normal file
View File

@ -0,0 +1,42 @@
Return-Path: <jake@adventuretime.ooo>
Received: from iceking.adventuretime.ooo ([unix socket]) by iceking (Cyrus v2.2.13-Debian-2.2.13-19+squeeze3) with LMTPA; Thu, 13 Jun 2013 17:03:50 -0400
Received: from mail-ie0-x234.google.com (mail-ie0-x234.google.com [IPv6:2607:f8b0:4001:c03::234]) by iceking.adventuretime.ooo (8.14.3/8.14.3/Debian-9.4) with ESMTP id r5DL3nFJ016967 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for <reply+59d8df8370b7e95c5a49fbf86aeb2c93@appmail.adventuretime.ooo>; Thu, 13 Jun 2013 17:03:50 -0400
Received: by mail-ie0-f180.google.com with SMTP id f4so21977375iea.25 for <reply+59d8df8370b7e95c5a49fbf86aeb2c93@appmail.adventuretime.ooo>; Thu, 13 Jun 2013 14:03:48 -0700
Received: by 10.0.0.1 with HTTP; Thu, 13 Jun 2013 14:03:48 -0700
Date: Thu, 13 Jun 2013 17:03:48 -0400
From: Jake the Dog <jake@adventuretime.ooo>
To: reply+59d8df8370b7e95c5a49fbf86aeb2c93@appmail.adventuretime.ooo
Message-ID: <CADkmRc+rNGAGGbV2iE5p918UVy4UyJqVcXRO2=otppgzduJSg@mail.gmail.com>
Subject: re: [Discourse Meta] eviltrout posted in 'Adventure Time Sux'
Mime-Version: 1.0
Content-Type: text/plain;
charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Sieve: CMU Sieve 2.2
X-Received: by 10.0.0.1 with SMTP id n7mr11234144ipb.85.1371157428600; Thu,
13 Jun 2013 14:03:48 -0700 (PDT)
X-Scanned-By: MIMEDefang 2.69 on IPv6:2001:470:1d:165::1
Is there any reason the *old* candy can't be be kept in silos while the new candy
is imported into *new* silos?
The thing about candy is it stays delicious for a long time -- we can just keep
it there without worrying about it too much, imo.
Thanks for listening.
On Sun, Jun 9, 2013 at 1:39 PM, eviltrout via Discourse Meta
<reply+59d8df8370b7e95c5a49fbf86aeb2c93@appmail.adventuretime.ooo> wrote:
>
>
>
> eviltrout posted in 'Adventure Time Sux' on Discourse Meta:
>
> ---
> hey guys everyone knows adventure time sucks!
>
> ---
> Please visit this link to respond: http://localhost:3000/t/adventure-time-sux/1234/3
>
> To unsubscribe from these emails, visit your [user preferences](http://localhost:3000/user_preferences).
>