<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>test/fixtures/mail_handler/message_reply.eml</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -158,6 +158,24 @@ class MailHandler &lt; 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) &amp;&amp; !message.locked?
+        reply = Message.new(:subject =&gt; email.subject, :content =&gt; plain_text_body)
+        reply.author = user
+        reply.board = message.board
+        message.children &lt;&lt; reply
+        add_attachments(reply)
+        reply
+      else
+        raise UnauthorizedAction
+      end
+    end
+  end
+  
   def add_attachments(obj)
     if email.has_attachments?
       email.attachments.each do |attachment|</diff>
      <filename>app/models/mail_handler.rb</filename>
    </modified>
    <modified>
      <diff>@@ -30,7 +30,9 @@ class MailHandlerTest &lt; Test::Unit::TestCase
                    :enumerations,
                    :issue_categories,
                    :custom_fields,
-                   :custom_fields_trackers
+                   :custom_fields_trackers,
+                   :boards,
+                   :messages
   
   FIXTURES_PATH = File.dirname(__FILE__) + '/../fixtures/mail_handler'
   
@@ -141,6 +143,16 @@ class MailHandlerTest &lt; Test::Unit::TestCase
     assert_equal IssueStatus.find_by_name(&quot;Resolved&quot;), issue.status
   end
   
+  def test_reply_to_a_message
+    m = submit_email('message_reply.eml')
+    assert m.is_a?(Message)
+    assert !m.new_record?
+    m.reload
+    assert_equal 'Reply via email', m.subject
+    # The email replies to message #2 which is part of the thread of message #1
+    assert_equal Message.find(1), m.parent
+  end
+  
   def test_should_strip_tags_of_html_only_emails
     issue = submit_email('ticket_html_only.eml', :issue =&gt; {:project =&gt; 'ecookbook'})
     assert issue.is_a?(Issue)</diff>
      <filename>test/unit/mail_handler_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>0c4e40b89cfeab5feb9cfa0aecd6f2233134a076</id>
    </parent>
  </parents>
  <author>
    <name>Jean-Philippe Lang</name>
    <email>jp_lang@yahoo.fr</email>
  </author>
  <url>http://github.com/tricycle/redmine/commit/b9e3fbcd83766329fd7c891291a5efc46ea51eb2</url>
  <id>b9e3fbcd83766329fd7c891291a5efc46ea51eb2</id>
  <committed-date>2009-01-19T11:03:53-08:00</committed-date>
  <authored-date>2009-01-19T11:03:53-08:00</authored-date>
  <message>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</message>
  <tree>c523871efcda689848cdeb82b0bf1ba975be93ce</tree>
  <committer>
    <name>Jean-Philippe Lang</name>
    <email>jp_lang@yahoo.fr</email>
  </committer>
</commit>
