From: Jean-Philippe Lang Date: Sat, 7 Mar 2009 11:22:56 +0000 (+0000) Subject: Merged r2553 from trunk. X-Git-Tag: 0.8.2~4 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=b366375e7ee1e2d76ec3c257e45cb793ae30a6a9;p=redmine.git Merged r2553 from trunk. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.8-stable@2557 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/app/models/mail_handler.rb b/app/models/mail_handler.rb index e976e2d7e..4c6925cda 100644 --- a/app/models/mail_handler.rb +++ b/app/models/mail_handler.rb @@ -40,7 +40,7 @@ class MailHandler < ActionMailer::Base # Processes incoming emails def receive(email) @email = email - @user = User.active.find(:first, :conditions => ["LOWER(mail) = ?", email.from.first.to_s.strip.downcase]) + @user = User.active.find(:first, :conditions => ["LOWER(mail) = ?", email.from.to_a.first.to_s.strip.downcase]) unless @user # Unknown user => the email is ignored # TODO: ability to create the user's account diff --git a/doc/CHANGELOG b/doc/CHANGELOG index e27ab0a2a..c197420da 100644 --- a/doc/CHANGELOG +++ b/doc/CHANGELOG @@ -18,6 +18,8 @@ http://www.redmine.org/ * Fixed: "too few arguments" error may occur on activerecord error translation * Fixed: "Default columns Displayed on the Issues list" setting is not easy to read * Fixed: visited links to closed tickets are not striked through with IE6 +* Fixed: MailHandler#plain_text_body returns nil if there was nothing to strip +* Fixed: MailHandler raises an error when processing an email without From header == 2009-02-15 v0.8.1 diff --git a/test/fixtures/mail_handler/ticket_without_from_header.eml b/test/fixtures/mail_handler/ticket_without_from_header.eml new file mode 100644 index 000000000..b49f22ce4 --- /dev/null +++ b/test/fixtures/mail_handler/ticket_without_from_header.eml @@ -0,0 +1,40 @@ +Received: from osiris ([127.0.0.1]) + by OSIRIS + with hMailServer ; Sun, 22 Jun 2008 12:28:07 +0200 +Message-ID: <000501c8d452$a95cd7e0$0a00a8c0@osiris> +To: +Subject: New ticket on a given project +Date: Sun, 22 Jun 2008 12:28:07 +0200 +MIME-Version: 1.0 +Content-Type: text/plain; + format=flowed; + charset="iso-8859-1"; + reply-type=original +Content-Transfer-Encoding: 7bit +X-Priority: 3 +X-MSMail-Priority: Normal +X-Mailer: Microsoft Outlook Express 6.00.2900.2869 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 + +Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas imperdiet +turpis et odio. Integer eget pede vel dolor euismod varius. Phasellus +blandit eleifend augue. Nulla facilisi. Duis id diam. Class aptent taciti +sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. In +in urna sed tellus aliquet lobortis. Morbi scelerisque tortor in dolor. Cras +sagittis odio eu lacus. Aliquam sem tortor, consequat sit amet, vestibulum +id, iaculis at, lectus. Fusce tortor libero, congue ut, euismod nec, luctus +eget, eros. Pellentesque tortor enim, feugiat in, dignissim eget, tristique +sed, mauris. Pellentesque habitant morbi tristique senectus et netus et +malesuada fames ac turpis egestas. Quisque sit amet libero. In hac habitasse +platea dictumst. + +Nulla et nunc. Duis pede. Donec et ipsum. Nam ut dui tincidunt neque +sollicitudin iaculis. Duis vitae dolor. Vestibulum eget massa. Sed lorem. +Nullam volutpat cursus erat. Cras felis dolor, lacinia quis, rutrum et, +dictum et, ligula. Sed erat nibh, gravida in, accumsan non, placerat sed, +massa. Sed sodales, ante fermentum ultricies sollicitudin, massa leo +pulvinar dui, a gravida orci mi eget odio. Nunc a lacus. + +Project: onlinestore +Status: Resolved + diff --git a/test/unit/mail_handler_test.rb b/test/unit/mail_handler_test.rb index 02f823d6b..5840ba556 100644 --- a/test/unit/mail_handler_test.rb +++ b/test/unit/mail_handler_test.rb @@ -127,6 +127,11 @@ class MailHandlerTest < Test::Unit::TestCase assert_equal 1, issue.watchers.size end + def test_add_issue_without_from_header + Role.anonymous.add_permission!(:add_issues) + assert_equal false, submit_email('ticket_without_from_header.eml') + end + def test_add_issue_note journal = submit_email('ticket_reply.eml') assert journal.is_a?(Journal)