Project

General

Profile

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

mark burdett, 2013-01-11 16:04

View differences:

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
    issue = Issue.find_by_subject(issue_subject)
221
    if issue
222
      receive_issue_reply(issue.id)
223
    else
224
      receive_issue
225
    end
226
  end
227

  
215 228
  # Reply will be added to the issue
216 229
  def receive_journal_reply(journal_id)
217 230
    journal = Journal.find_by_id(journal_id)
(1-1/5)