]> source.dussan.org Git - redmine.git/commitdiff
Merged r17817 to 4.0-stable (#30455).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 19 Jan 2019 11:00:31 +0000 (11:00 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 19 Jan 2019 11:00:31 +0000 (11:00 +0000)
git-svn-id: http://svn.redmine.org/redmine/branches/4.0-stable@17818 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/mail_handler.rb
test/functional/mail_handler_controller_test.rb

index 073e0dcc01fa984422aa22609e23e53c4beddf43..9298e1b12b4fdbb28fba16ef94f45db0606fa547 100755 (executable)
@@ -237,7 +237,7 @@ class MailHandler < ActionMailer::Base
     end
 
     # ignore CLI-supplied defaults for new issues
-    handler_options[:issue].clear
+    handler_options[:issue] = {}
 
     journal = issue.init_journal(user)
     if from_journal && from_journal.private_notes?
index 633465471b513f36390b3b6a28be021bb4fc3df7..707373942c5a214a78a151e794e8faafd958c41d 100644 (file)
@@ -60,6 +60,22 @@ class MailHandlerControllerTest < Redmine::ControllerTest
     assert_equal true, issue.is_private
   end
 
+  def test_should_update_issue
+    # Enable API and set a key
+    Setting.mail_handler_api_enabled = 1
+    Setting.mail_handler_api_key = 'secret'
+
+    assert_no_difference 'Issue.count' do
+      assert_difference 'Journal.count' do
+        post :index, :params => {
+            :key => 'secret',
+            :email => IO.read(File.join(FIXTURES_PATH, 'ticket_reply.eml'))
+          }
+      end
+    end
+    assert_response 201
+  end
+
   def test_should_respond_with_422_if_not_created
     Project.find('onlinestore').destroy