Project

General

Profile

Patch #12813 » redmine-issue-reply-match-by-subject.patch

mark burdett, 2013-08-16 03:09

View differences:

mail_handler.rb (working copy)
MESSAGE_ID_RE = %r{^<?redmine\.([a-z0-9_]+)\-(\d+)\.\d+(\.[a-f0-9]+)?@}
ISSUE_REPLY_SUBJECT_RE = %r{\[[^\]]*#(\d+)\]}
MESSAGE_REPLY_SUBJECT_RE = %r{\[[^\]]*msg(\d+)\]}
ISSUE_REPLY_MATCH_ISSUE_SUBJECT_RE = %r{^Re: (.+)$}
def dispatch
headers = [email.in_reply_to, email.references].flatten.compact
......
receive_issue_reply(m[1].to_i)
elsif m = subject.match(MESSAGE_REPLY_SUBJECT_RE)
receive_message_reply(m[1].to_i)
elsif m = subject.match(ISSUE_REPLY_MATCH_ISSUE_SUBJECT_RE)
receive_issue_reply_subject(m[1].to_s, m[0].to_s)
else
dispatch_to_default
end
......
journal
end
# Adds a note to an existing issue, matched by subject
def receive_issue_reply_subject(issue_subject, re_issue_subject)
if issue = Issue.find_last_by_subject(issue_subject)
receive_issue_reply(issue.id)
elsif issue = Issue.find_last_by_subject(re_issue_subject)
receive_issue_reply(issue.id)
else
receive_issue
end
end
# Reply will be added to the issue
def receive_journal_reply(journal_id)
journal = Journal.find_by_id(journal_id)
(3-3/5)