mirror of
https://github.com/discourse/discourse.git
synced 2025-03-24 05:12:00 +08:00
Fix for non-english email polling.
This commit is contained in:
parent
b8e63719f8
commit
c86b06e3fa
@ -26,7 +26,7 @@ module Email
|
|||||||
return Email::Receiver.results[:unprocessable] if @body.blank?
|
return Email::Receiver.results[:unprocessable] if @body.blank?
|
||||||
|
|
||||||
# Then run the github EmailReplyParser on it in case we didn't catch it
|
# Then run the github EmailReplyParser on it in case we didn't catch it
|
||||||
@body = EmailReplyParser.read(@body).visible_text
|
@body = EmailReplyParser.read(@body).visible_text.force_encoding('UTF-8')
|
||||||
|
|
||||||
discourse_email_parser
|
discourse_email_parser
|
||||||
|
|
||||||
|
@ -50,6 +50,17 @@ stripped from my reply?")
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "It supports a non english reply" do
|
||||||
|
let(:hebrew) { File.read("#{Rails.root}/spec/fixtures/emails/hebrew.eml") }
|
||||||
|
let(:receiver) { Email::Receiver.new(hebrew) }
|
||||||
|
|
||||||
|
it "processes correctly" do
|
||||||
|
I18n.expects(:t).with('user_notifications.previous_discussion').returns('כלטוב')
|
||||||
|
receiver.process
|
||||||
|
expect(receiver.body).to eq("שלום")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe "via" do
|
describe "via" do
|
||||||
let(:wrote) { File.read("#{Rails.root}/spec/fixtures/emails/via_line.eml") }
|
let(:wrote) { File.read("#{Rails.root}/spec/fixtures/emails/via_line.eml") }
|
||||||
let(:receiver) { Email::Receiver.new(wrote) }
|
let(:receiver) { Email::Receiver.new(wrote) }
|
||||||
|
17
spec/fixtures/emails/hebrew.eml
vendored
Normal file
17
spec/fixtures/emails/hebrew.eml
vendored
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
|
||||||
|
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: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: base64
|
||||||
|
|
||||||
|
16nXnNeV150=
|
Loading…
x
Reference in New Issue
Block a user