Patch #12813 » redmine-issue-reply-match-by-subject.patch
app/models/mail_handler.rb (working copy) | ||
---|---|---|
121 | 121 |
MESSAGE_ID_RE = %r{^<?redmine\.([a-z0-9_]+)\-(\d+)\.\d+@} |
122 | 122 |
ISSUE_REPLY_SUBJECT_RE = %r{\[[^\]]*#(\d+)\]} |
123 | 123 |
MESSAGE_REPLY_SUBJECT_RE = %r{\[[^\]]*msg(\d+)\]} |
124 |
ISSUE_REPLY_MATCH_ISSUE_SUBJECT_RE = %r{^Re: (.+)$} |
|
124 | 125 | |
125 | 126 |
def dispatch |
126 | 127 |
headers = [email.in_reply_to, email.references].flatten.compact |
... | ... | |
137 | 138 |
receive_issue_reply(m[1].to_i) |
138 | 139 |
elsif m = subject.match(MESSAGE_REPLY_SUBJECT_RE) |
139 | 140 |
receive_message_reply(m[1].to_i) |
141 |
elsif m = subject.match(ISSUE_REPLY_MATCH_ISSUE_SUBJECT_RE) |
|
142 |
receive_issue_reply_subject(m[1].to_s) |
|
140 | 143 |
else |
141 | 144 |
dispatch_to_default |
142 | 145 |
end |
... | ... | |
212 | 215 |
journal |
213 | 216 |
end |
214 | 217 | |
218 |
# Adds a note to an existing issue, matched by subject |
|
219 |
def receive_issue_reply_subject(issue_subject) |
|
220 |
if issue = Issue.find_last_by_subject(issue_subject) |
|
221 |
receive_issue_reply(issue.id) |
|
222 |
else |
|
223 |
receive_issue |
|
224 |
end |
|
225 |
end |
|
226 | ||
215 | 227 |
# Reply will be added to the issue |
216 | 228 |
def receive_journal_reply(journal_id) |
217 | 229 |
journal = Journal.find_by_id(journal_id) |