]> source.dussan.org Git - redmine.git/commitdiff
Backport the fix r18239 to 4.0-stable (#31503).
authorGo MAEDA <maeda@farend.jp>
Mon, 10 Jun 2019 02:07:46 +0000 (02:07 +0000)
committerGo MAEDA <maeda@farend.jp>
Mon, 10 Jun 2019 02:07:46 +0000 (02:07 +0000)
git-svn-id: http://svn.redmine.org/redmine/branches/4.0-stable@18240 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/mail_handler.rb
test/unit/mail_handler_test.rb

index 4f2c8cc0496af52d0e3ced57bee01d8b2d2e7281..d11b6f4ff1a186182e430e977943605eabe63d34 100755 (executable)
@@ -287,7 +287,7 @@ class MailHandler < ActionMailer::Base
         reply
       else
         if logger
-          logger.info "MailHandler: ignoring reply from [#{sender_email}] to a locked topic"
+          logger.info "MailHandler: ignoring reply from [#{email.from.first}] to a locked topic"
         end
       end
     end
index 246434e3c43179f98bd78978733b733707c98917..940dce5c46abc69adb9b36644b0d9a2613c70aec 100644 (file)
@@ -988,6 +988,17 @@ class MailHandlerTest < ActiveSupport::TestCase
     assert_equal Message.find(1), m.parent
   end
 
+  def test_reply_to_a_locked_topic
+    # Lock the topic
+    topic = Message.find(2).parent
+    topic.update_attribute :locked, true
+
+    assert_no_difference('topic.replies_count') do
+      m = submit_email('message_reply_by_subject.eml')
+      assert_not_kind_of Message, m
+    end
+  end
+
   def test_should_convert_tags_of_html_only_emails
     with_settings :text_formatting => 'textile' do
       issue = submit_email('ticket_html_only.eml', :issue => {:project => 'ecookbook'})