mirror of
https://github.com/codeninjasllc/discourse.git
synced 2025-02-17 04:01:29 -05:00
FIX: Another email regexp for quote lines in the format we can recognize including
the site name.
This commit is contained in:
parent
adbb6a19bb
commit
ff3b163a78
3 changed files with 36 additions and 0 deletions
|
@ -93,6 +93,7 @@ module Email
|
|||
email_year = lines.each_with_index do |l, idx|
|
||||
break if l =~ /\A\s*\-{3,80}\s*\z/ ||
|
||||
l =~ Regexp.new("\\A\\s*" + I18n.t('user_notifications.previous_discussion') + "\\s*\\Z") ||
|
||||
(l =~ /via #{SiteSetting.title}(.*)\:$/) ||
|
||||
# This one might be controversial but so many reply lines have years, times and end with a colon.
|
||||
# Let's try it and see how well it works.
|
||||
(l =~ /\d{4}/ && l =~ /\d:\d\d/ && l =~ /\:$/)
|
||||
|
|
|
@ -50,6 +50,16 @@ stripped from my reply?")
|
|||
end
|
||||
end
|
||||
|
||||
describe "via" do
|
||||
let(:wrote) { File.read("#{Rails.root}/spec/fixtures/emails/via_line.eml") }
|
||||
let(:receiver) { Email::Receiver.new(wrote) }
|
||||
|
||||
it "removes via lines if we know them" do
|
||||
receiver.process
|
||||
expect(receiver.body).to eq("Hello this email has content!")
|
||||
end
|
||||
end
|
||||
|
||||
describe "if wrote is on a second line" do
|
||||
let(:wrote) { File.read("#{Rails.root}/spec/fixtures/emails/multiline_wrote.eml") }
|
||||
let(:receiver) { Email::Receiver.new(wrote) }
|
||||
|
|
25
spec/fixtures/emails/via_line.eml
vendored
Normal file
25
spec/fixtures/emails/via_line.eml
vendored
Normal file
|
@ -0,0 +1,25 @@
|
|||
|
||||
Delivered-To: discourse-reply+cd480e301683c9902891f15968bf07a5@discourse.org
|
||||
Received: by 10.194.216.104 with SMTP id op8csp80593wjc;
|
||||
Wed, 24 Jul 2013 07:59:14 -0700 (PDT)
|
||||
Return-Path: <walter.white@googlemail.com>
|
||||
References: <topic/5043@discourse.org> <51efeb9b36c34_66dc2dfce6811866@discourse.mail>
|
||||
From: Walter White <walter.white@googlemail.com>
|
||||
In-Reply-To: <51efeb9b36c34_66dc2dfce6811866@discourse.mail>
|
||||
Mime-Version: 1.0 (1.0)
|
||||
Date: Wed, 24 Jul 2013 15:59:10 +0100
|
||||
Message-ID: <4597127794206131679@unknownmsgid>
|
||||
Subject: Re: [Discourse] new reply to your post in 'Crystal Blue'
|
||||
To: walter via Discourse <discourse-reply+cd480e301683c9902891f15968bf07a5@discourse.org>
|
||||
Content-Type: multipart/alternative; boundary=001a11c20edc15a39304e2432790
|
||||
|
||||
Hello this email has content!
|
||||
|
||||
codinghorror via Discourse wrote:
|
||||
> [codinghorror] codinghorror
|
||||
> <http://meta.discourse.org/users/codinghorror>
|
||||
> August 7
|
||||
>
|
||||
> It wouldn't be great at the moment for 100% email, since there's no
|
||||
> way to be notified of new topics via email. (you can get notified of
|
||||
> new replies to your posts and topics via email, and reply to them.)
|
Loading…
Reference in a new issue