summaryrefslogtreecommitdiffstats
path: root/app/models/mail_handler.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2009-01-21 18:22:30 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2009-01-21 18:22:30 +0000
commitdfab202cdec1e4cba0c10281142090c74ccabaf8 (patch)
tree3bb712a79f074d703983ea55adb1a7d3953e4e8e /app/models/mail_handler.rb
parentb80caf762ab9d16cd498a05c7dfdb5832dc96c15 (diff)
downloadredmine-dfab202cdec1e4cba0c10281142090c74ccabaf8.tar.gz
redmine-dfab202cdec1e4cba0c10281142090c74ccabaf8.zip
Accept replies to forum messages by subject recognition (#1616).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2294 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/mail_handler.rb')
-rw-r--r--app/models/mail_handler.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/app/models/mail_handler.rb b/app/models/mail_handler.rb
index 4ebaa6505..ea9671ff6 100644
--- a/app/models/mail_handler.rb
+++ b/app/models/mail_handler.rb
@@ -55,6 +55,7 @@ class MailHandler < ActionMailer::Base
MESSAGE_ID_RE = %r{^<redmine\.([a-z0-9_]+)\-(\d+)\.\d+@}
ISSUE_REPLY_SUBJECT_RE = %r{\[[^\]]+#(\d+)\]}
+ MESSAGE_REPLY_SUBJECT_RE = %r{\[[^\]]+msg(\d+)\]}
def dispatch
headers = [email.in_reply_to, email.references].flatten.compact
@@ -67,8 +68,9 @@ class MailHandler < ActionMailer::Base
# ignoring it
end
elsif m = email.subject.match(ISSUE_REPLY_SUBJECT_RE)
- # for compatibility
receive_issue_reply(m[1].to_i)
+ elsif m = email.subject.match(MESSAGE_REPLY_SUBJECT_RE)
+ receive_message_reply(m[1].to_i)
else
receive_issue
end
@@ -164,7 +166,8 @@ class MailHandler < ActionMailer::Base
if message
message = message.root
if user.allowed_to?(:add_messages, message.project) && !message.locked?
- reply = Message.new(:subject => email.subject, :content => plain_text_body)
+ reply = Message.new(:subject => email.subject.gsub(%r{^.*msg\d+\]}, '').strip,
+ :content => plain_text_body)
reply.author = user
reply.board = message.board
message.children << reply