summaryrefslogtreecommitdiffstats
path: root/app/models/mail_handler.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2009-01-19 19:03:53 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2009-01-19 19:03:53 +0000
commitb9e3fbcd83766329fd7c891291a5efc46ea51eb2 (patch)
treec523871efcda689848cdeb82b0bf1ba975be93ce /app/models/mail_handler.rb
parent0c4e40b89cfeab5feb9cfa0aecd6f2233134a076 (diff)
downloadredmine-b9e3fbcd83766329fd7c891291a5efc46ea51eb2.tar.gz
redmine-b9e3fbcd83766329fd7c891291a5efc46ea51eb2.zip
Allow email to reply to a forum message (#1616).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2289 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/mail_handler.rb')
-rw-r--r--app/models/mail_handler.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/app/models/mail_handler.rb b/app/models/mail_handler.rb
index f6be1f124..4ebaa6505 100644
--- a/app/models/mail_handler.rb
+++ b/app/models/mail_handler.rb
@@ -158,6 +158,24 @@ class MailHandler < ActionMailer::Base
end
end
+ # Receives a reply to a forum message
+ def receive_message_reply(message_id)
+ message = Message.find_by_id(message_id)
+ 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.author = user
+ reply.board = message.board
+ message.children << reply
+ add_attachments(reply)
+ reply
+ else
+ raise UnauthorizedAction
+ end
+ end
+ end
+
def add_attachments(obj)
if email.has_attachments?
email.attachments.each do |attachment|