]> source.dussan.org Git - redmine.git/commitdiff
Fixed: CLI-supplied defaults should not be applied when replying to an issue (#7195).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Wed, 29 Dec 2010 17:38:57 +0000 (17:38 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Wed, 29 Dec 2010 17:38:57 +0000 (17:38 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4576 e93f8b46-1217-0410-a6f0-8f06a7374b81

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

index 4b6b4a4027951aff08eb091b1cf3882b45a60aa1..617f0ee11f8e8e80f220ab2528fded5919ae71ee 100644 (file)
@@ -148,6 +148,9 @@ class MailHandler < ActionMailer::Base
       raise UnauthorizedAction unless user.allowed_to?(:add_issue_notes, issue.project) || user.allowed_to?(:edit_issues, issue.project)
     end
     
+    # ignore CLI-supplied defaults for new issues
+    @@handler_options[:issue].clear
+    
     journal = issue.init_journal(user, cleaned_up_text_body)
     issue.safe_attributes = issue_attributes_from_keywords(issue)
     issue.safe_attributes = {'custom_field_values' => custom_field_values_from_keywords(issue)}
index df22bddc8266d26f9a7bbbe58f80a40e0ae581fd..a9f7b77dac52ad2b06a11c52e3c29b38096979ba 100644 (file)
@@ -327,6 +327,14 @@ class MailHandlerTest < ActiveSupport::TestCase
     assert_equal 1, ActionMailer::Base.deliveries.size
   end
   
+  def test_add_issue_note_should_not_set_defaults
+    journal = submit_email('ticket_reply.eml', :issue => {:tracker => 'Support request', :priority => 'High'})
+    assert journal.is_a?(Journal)
+    assert_match /This is reply/, journal.notes
+    assert_equal 'Feature request', journal.issue.tracker.name
+    assert_equal 'Normal', journal.issue.priority.name
+  end
+  
   def test_reply_to_a_message
     m = submit_email('message_reply.eml')
     assert m.is_a?(Message)