@@ -203,10 +203,17 class MailHandler < ActionMailer::Base | |||
|
203 | 203 | end |
|
204 | 204 | |
|
205 | 205 | def get_keyword(attr, options={}) |
|
206 | if (options[:override] || @@handler_options[:allow_override].include?(attr.to_s)) && plain_text_body =~ /^#{attr}:[ \t]*(.+)$/i | |
|
207 | $1.strip | |
|
208 | elsif !@@handler_options[:issue][attr].blank? | |
|
209 | @@handler_options[:issue][attr] | |
|
206 | @keywords ||= {} | |
|
207 | if @keywords.has_key?(attr) | |
|
208 | @keywords[attr] | |
|
209 | else | |
|
210 | @keywords[attr] = begin | |
|
211 | if (options[:override] || @@handler_options[:allow_override].include?(attr.to_s)) && plain_text_body.gsub!(/^#{attr}:[ \t]*(.+)\s*$/i, '') | |
|
212 | $1.strip | |
|
213 | elsif !@@handler_options[:issue][attr].blank? | |
|
214 | @@handler_options[:issue][attr] | |
|
215 | end | |
|
216 | end | |
|
210 | 217 | end |
|
211 | 218 | end |
|
212 | 219 |
@@ -49,7 +49,11 class MailHandlerTest < Test::Unit::TestCase | |||
|
49 | 49 | assert_equal 'New ticket on a given project', issue.subject |
|
50 | 50 | assert_equal User.find_by_login('jsmith'), issue.author |
|
51 | 51 | assert_equal Project.find(2), issue.project |
|
52 | assert_equal IssueStatus.find_by_name('Resolved'), issue.status | |
|
52 | 53 | assert issue.description.include?('Lorem ipsum dolor sit amet, consectetuer adipiscing elit.') |
|
54 | # keywords should be removed from the email body | |
|
55 | assert !issue.description.match(/^Project:/i) | |
|
56 | assert !issue.description.match(/^Status:/i) | |
|
53 | 57 | end |
|
54 | 58 | |
|
55 | 59 | def test_add_issue_with_status |
@@ -113,6 +117,7 class MailHandlerTest < Test::Unit::TestCase | |||
|
113 | 117 | issue.reload |
|
114 | 118 | assert_equal 'New ticket with custom field values', issue.subject |
|
115 | 119 | assert_equal 'Value for a custom field', issue.custom_value_for(CustomField.find_by_name('Searchable field')).value |
|
120 | assert !issue.description.match(/^searchable field:/i) | |
|
116 | 121 | end |
|
117 | 122 | |
|
118 | 123 | def test_add_issue_with_cc |
General Comments 0
You need to be logged in to leave comments.
Login now