mirror of
https://github.com/discourse/discourse.git
synced 2025-01-31 13:57:20 +08:00
handle emails with localized headers 😠
This commit is contained in:
parent
6b4f265a8c
commit
185dcb2ca1
|
@ -239,6 +239,8 @@ module Email
|
||||||
end
|
end
|
||||||
|
|
||||||
def parse_from_field(mail)
|
def parse_from_field(mail)
|
||||||
|
return unless mail[:from]
|
||||||
|
|
||||||
if mail[:from].errors.blank?
|
if mail[:from].errors.blank?
|
||||||
mail[:from].address_list.addresses.each do |address_field|
|
mail[:from].address_list.addresses.each do |address_field|
|
||||||
address_field.decoded
|
address_field.decoded
|
||||||
|
|
|
@ -383,8 +383,10 @@ describe Email::Receiver do
|
||||||
expect(Post.last.raw).to match(/discourse\.rb/)
|
expect(Post.last.raw).to match(/discourse\.rb/)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "with forwarded emails enabled" do
|
||||||
|
before { SiteSetting.enable_forwarded_emails = true }
|
||||||
|
|
||||||
it "handles forwarded emails" do
|
it "handles forwarded emails" do
|
||||||
SiteSetting.enable_forwarded_emails = true
|
|
||||||
expect { process(:forwarded_email_1) }.to change(Topic, :count)
|
expect { process(:forwarded_email_1) }.to change(Topic, :count)
|
||||||
|
|
||||||
forwarded_post, last_post = *Post.last(2)
|
forwarded_post, last_post = *Post.last(2)
|
||||||
|
@ -416,6 +418,13 @@ describe Email::Receiver do
|
||||||
expect(last_post.post_type).to eq(Post.types[:whisper])
|
expect(last_post.post_type).to eq(Post.types[:whisper])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Who thought this was a good idea?!
|
||||||
|
it "doesn't blow up with localized email headers" do
|
||||||
|
expect { process(:forwarded_email_3) }.to change(Topic, :count)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context "new topic in a category" do
|
context "new topic in a category" do
|
||||||
|
|
18
spec/fixtures/emails/forwarded_email_3.eml
vendored
Normal file
18
spec/fixtures/emails/forwarded_email_3.eml
vendored
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
Message-ID: <60@foo.bar.mail>
|
||||||
|
From: Ba Bar <ba@bar.com>
|
||||||
|
To: Team <team@bar.com>
|
||||||
|
Date: Mon, 9 Dec 2016 13:37:42 +0100
|
||||||
|
Subject: Fwd: Ça Discourse ?
|
||||||
|
|
||||||
|
@team, can you have a look at this email below?
|
||||||
|
|
||||||
|
Objet: Ça Discourse ?
|
||||||
|
Date: 2017-01-04 11:27
|
||||||
|
De: Un Français <un@francais.fr>
|
||||||
|
À: ba@bar.com
|
||||||
|
|
||||||
|
Bonjour,
|
||||||
|
|
||||||
|
Ça Discourse bien aujourd'hui ?
|
||||||
|
|
||||||
|
Bises
|
Loading…
Reference in New Issue
Block a user