Patch #12813 » redmine-issue-reply-match-by-subject.patch
| app/models/mail_handler.rb (working copy) | ||
|---|---|---|
|
MESSAGE_ID_RE = %r{^<?redmine\.([a-z0-9_]+)\-(\d+)\.\d+(\.[a-f0-9]+)?@}
|
||
|
ISSUE_REPLY_SUBJECT_RE = %r{\[(?:[^\]]*\s+)?#(\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.where(subject: issue_subject).last
|
||
|
receive_issue_reply(issue.id)
|
||
|
elsif issue = Issue.where(subject: re_issue_subject).last
|
||
|
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)
|
||
- « Previous
- 1
- …
- 3
- 4
- 5
- Next »