##// END OF EJS Templates
Fixed: mail handler keywords are not removed when updating issues (#7785)....
Jean-Philippe Lang -
r4985:59bf5cea6ec4
parent child
Show More
@@ -155,9 +155,10 class MailHandler < ActionMailer::Base
155 # ignore CLI-supplied defaults for new issues
155 # ignore CLI-supplied defaults for new issues
156 @@handler_options[:issue].clear
156 @@handler_options[:issue].clear
157
157
158 journal = issue.init_journal(user, cleaned_up_text_body)
158 journal = issue.init_journal(user)
159 issue.safe_attributes = issue_attributes_from_keywords(issue)
159 issue.safe_attributes = issue_attributes_from_keywords(issue)
160 issue.safe_attributes = {'custom_field_values' => custom_field_values_from_keywords(issue)}
160 issue.safe_attributes = {'custom_field_values' => custom_field_values_from_keywords(issue)}
161 journal.notes = cleaned_up_text_body
161 add_attachments(issue)
162 add_attachments(issue)
162 issue.save!
163 issue.save!
163 logger.info "MailHandler: issue ##{issue.id} updated by #{user}" if logger && logger.info
164 logger.info "MailHandler: issue ##{issue.id} updated by #{user}" if logger && logger.info
@@ -70,6 +70,7 class MailHandlerTest < ActiveSupport::TestCase
70 # keywords should be removed from the email body
70 # keywords should be removed from the email body
71 assert !issue.description.match(/^Project:/i)
71 assert !issue.description.match(/^Project:/i)
72 assert !issue.description.match(/^Status:/i)
72 assert !issue.description.match(/^Status:/i)
73 assert !issue.description.match(/^Start Date:/i)
73 # Email notification should be sent
74 # Email notification should be sent
74 mail = ActionMailer::Base.deliveries.last
75 mail = ActionMailer::Base.deliveries.last
75 assert_not_nil mail
76 assert_not_nil mail
@@ -318,6 +319,9 class MailHandlerTest < ActiveSupport::TestCase
318 assert_equal '2010-12-31', issue.due_date.to_s
319 assert_equal '2010-12-31', issue.due_date.to_s
319 assert_equal User.find_by_login('jsmith'), issue.assigned_to
320 assert_equal User.find_by_login('jsmith'), issue.assigned_to
320 assert_equal "52.6", issue.custom_value_for(CustomField.find_by_name('Float field')).value
321 assert_equal "52.6", issue.custom_value_for(CustomField.find_by_name('Float field')).value
322 # keywords should be removed from the email body
323 assert !journal.notes.match(/^Status:/i)
324 assert !journal.notes.match(/^Start Date:/i)
321 end
325 end
322
326
323 def test_add_issue_note_should_send_email_notification
327 def test_add_issue_note_should_send_email_notification
General Comments 0
You need to be logged in to leave comments. Login now