mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 09:36:19 -05:00
Fix for non-english email polling.
This commit is contained in:
parent
b8e63719f8
commit
c86b06e3fa
3 changed files with 29 additions and 1 deletions
|
@ -26,7 +26,7 @@ module Email
|
|||
return Email::Receiver.results[:unprocessable] if @body.blank?
|
||||
|
||||
# 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
|
||||
|
||||
|
|
|
@ -50,6 +50,17 @@ stripped from my reply?")
|
|||
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
|
||||
let(:wrote) { File.read("#{Rails.root}/spec/fixtures/emails/via_line.eml") }
|
||||
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…
Reference in a new issue