@@ -145,7 +145,7 class MailHandler < ActionMailer::Base | |||||
145 | private |
|
145 | private | |
146 |
|
146 | |||
147 | MESSAGE_ID_RE = %r{^<?redmine\.([a-z0-9_]+)\-(\d+)\.\d+(\.[a-f0-9]+)?@} |
|
147 | MESSAGE_ID_RE = %r{^<?redmine\.([a-z0-9_]+)\-(\d+)\.\d+(\.[a-f0-9]+)?@} | |
148 | ISSUE_REPLY_SUBJECT_RE = %r{\[[^\]]*#(\d+)\]} |
|
148 | ISSUE_REPLY_SUBJECT_RE = %r{\[(?:[^\]]*\s+)?#(\d+)\]} | |
149 | MESSAGE_REPLY_SUBJECT_RE = %r{\[[^\]]*msg(\d+)\]} |
|
149 | MESSAGE_REPLY_SUBJECT_RE = %r{\[[^\]]*msg(\d+)\]} | |
150 |
|
150 | |||
151 | def dispatch |
|
151 | def dispatch |
@@ -663,6 +663,30 class MailHandlerTest < ActiveSupport::TestCase | |||||
663 | assert_equal 'Feature request', journal.issue.tracker.name |
|
663 | assert_equal 'Feature request', journal.issue.tracker.name | |
664 | end |
|
664 | end | |
665 |
|
665 | |||
|
666 | def test_update_issue_should_accept_issue_id_after_space_inside_brackets | |||
|
667 | journal = submit_email('ticket_reply_with_status.eml') do |email| | |||
|
668 | assert email.sub!(/^Subject:.*$/, "Subject: Re: [Feature request #2] Add ingredients categories") | |||
|
669 | end | |||
|
670 | assert journal.is_a?(Journal) | |||
|
671 | assert_equal Issue.find(2), journal.journalized | |||
|
672 | end | |||
|
673 | ||||
|
674 | def test_update_issue_should_accept_issue_id_inside_brackets | |||
|
675 | journal = submit_email('ticket_reply_with_status.eml') do |email| | |||
|
676 | assert email.sub!(/^Subject:.*$/, "Subject: Re: [#2] Add ingredients categories") | |||
|
677 | end | |||
|
678 | assert journal.is_a?(Journal) | |||
|
679 | assert_equal Issue.find(2), journal.journalized | |||
|
680 | end | |||
|
681 | ||||
|
682 | def test_update_issue_should_ignore_bogus_issue_ids_in_subject | |||
|
683 | journal = submit_email('ticket_reply_with_status.eml') do |email| | |||
|
684 | assert email.sub!(/^Subject:.*$/, "Subject: Re: [12345#1][bogus#1][Feature request #2] Add ingredients categories") | |||
|
685 | end | |||
|
686 | assert journal.is_a?(Journal) | |||
|
687 | assert_equal Issue.find(2), journal.journalized | |||
|
688 | end | |||
|
689 | ||||
666 | def test_update_issue_with_attribute_changes |
|
690 | def test_update_issue_with_attribute_changes | |
667 | # This email contains: 'Status: Resolved' |
|
691 | # This email contains: 'Status: Resolved' | |
668 | journal = submit_email('ticket_reply_with_status.eml') |
|
692 | journal = submit_email('ticket_reply_with_status.eml') |
General Comments 0
You need to be logged in to leave comments.
Login now