1
0
mirror of https://github.com/meineerde/redmine.git synced 2026-01-03 14:19:41 +00:00

Ignore bogus issue strings like [some-string#1234] in email subjects (#17705).

git-svn-id: http://svn.redmine.org/redmine/trunk@13593 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2014-11-14 20:43:15 +00:00
parent c12ba8a76c
commit 9b971925db
2 changed files with 25 additions and 1 deletions

View File

@ -145,7 +145,7 @@ class MailHandler < ActionMailer::Base
private
MESSAGE_ID_RE = %r{^<?redmine\.([a-z0-9_]+)\-(\d+)\.\d+(\.[a-f0-9]+)?@}
ISSUE_REPLY_SUBJECT_RE = %r{\[[^\]]*#(\d+)\]}
ISSUE_REPLY_SUBJECT_RE = %r{\[(?:[^\]]*\s+)?#(\d+)\]}
MESSAGE_REPLY_SUBJECT_RE = %r{\[[^\]]*msg(\d+)\]}
def dispatch

View File

@ -663,6 +663,30 @@ class MailHandlerTest < ActiveSupport::TestCase
assert_equal 'Feature request', journal.issue.tracker.name
end
def test_update_issue_should_accept_issue_id_after_space_inside_brackets
journal = submit_email('ticket_reply_with_status.eml') do |email|
assert email.sub!(/^Subject:.*$/, "Subject: Re: [Feature request #2] Add ingredients categories")
end
assert journal.is_a?(Journal)
assert_equal Issue.find(2), journal.journalized
end
def test_update_issue_should_accept_issue_id_inside_brackets
journal = submit_email('ticket_reply_with_status.eml') do |email|
assert email.sub!(/^Subject:.*$/, "Subject: Re: [#2] Add ingredients categories")
end
assert journal.is_a?(Journal)
assert_equal Issue.find(2), journal.journalized
end
def test_update_issue_should_ignore_bogus_issue_ids_in_subject
journal = submit_email('ticket_reply_with_status.eml') do |email|
assert email.sub!(/^Subject:.*$/, "Subject: Re: [12345#1][bogus#1][Feature request #2] Add ingredients categories")
end
assert journal.is_a?(Journal)
assert_equal Issue.find(2), journal.journalized
end
def test_update_issue_with_attribute_changes
# This email contains: 'Status: Resolved'
journal = submit_email('ticket_reply_with_status.eml')