@@ -0,0 +1,48 | |||
|
1 | Return-Path: <JSmith@somenet.foo> | |
|
2 | Received: from osiris ([127.0.0.1]) | |
|
3 | by OSIRIS | |
|
4 | with hMailServer ; Sun, 22 Jun 2008 12:28:07 +0200 | |
|
5 | Message-ID: <000501c8d452$a95cd7e0$0a00a8c0@osiris> | |
|
6 | In-Reply-To: <redmine.issue-2.20060719210421@osiris> | |
|
7 | From: "John Smith" <JSmith@somenet.foo> | |
|
8 | To: <redmine@somenet.foo> | |
|
9 | Subject: Re: update to issue 2 | |
|
10 | Date: Sun, 22 Jun 2008 12:28:07 +0200 | |
|
11 | MIME-Version: 1.0 | |
|
12 | Content-Type: text/plain; | |
|
13 | format=flowed; | |
|
14 | charset="iso-8859-1"; | |
|
15 | reply-type=original | |
|
16 | Content-Transfer-Encoding: 7bit | |
|
17 | X-Priority: 3 | |
|
18 | X-MSMail-Priority: Normal | |
|
19 | X-Mailer: Microsoft Outlook Express 6.00.2900.2869 | |
|
20 | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 | |
|
21 | ||
|
22 | An update to the issue by the sender. | |
|
23 | ||
|
24 | Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas imperdiet | |
|
25 | turpis et odio. Integer eget pede vel dolor euismod varius. Phasellus | |
|
26 | blandit eleifend augue. Nulla facilisi. Duis id diam. Class aptent taciti | |
|
27 | sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. In | |
|
28 | in urna sed tellus aliquet lobortis. Morbi scelerisque tortor in dolor. Cras | |
|
29 | sagittis odio eu lacus. Aliquam sem tortor, consequat sit amet, vestibulum | |
|
30 | id, iaculis at, lectus. Fusce tortor libero, congue ut, euismod nec, luctus | |
|
31 | eget, eros. Pellentesque tortor enim, feugiat in, dignissim eget, tristique | |
|
32 | sed, mauris --- Pellentesque habitant morbi tristique senectus et netus et | |
|
33 | malesuada fames ac turpis egestas. Quisque sit amet libero. In hac habitasse | |
|
34 | platea dictumst. | |
|
35 | ||
|
36 | >> > --- Reply above. Do not remove this line. --- | |
|
37 | >> > | |
|
38 | >> > Issue #6779 has been updated by Eric Davis. | |
|
39 | >> > | |
|
40 | >> > Subject changed from Projects with JSON to Project JSON API | |
|
41 | >> > Status changed from New to Assigned | |
|
42 | >> > Assignee set to Eric Davis | |
|
43 | >> > Priority changed from Low to Normal | |
|
44 | >> > Estimated time deleted (1.00) | |
|
45 | >> > | |
|
46 | >> > Looks like the JSON api for projects was missed. I'm going to be | |
|
47 | >> > reviewing the existing APIs and trying to clean them up over the next | |
|
48 | >> > few weeks. |
@@ -0,0 +1,48 | |||
|
1 | Return-Path: <JSmith@somenet.foo> | |
|
2 | Received: from osiris ([127.0.0.1]) | |
|
3 | by OSIRIS | |
|
4 | with hMailServer ; Sun, 22 Jun 2008 12:28:07 +0200 | |
|
5 | Message-ID: <000501c8d452$a95cd7e0$0a00a8c0@osiris> | |
|
6 | In-Reply-To: <redmine.issue-2.20060719210421@osiris> | |
|
7 | From: "John Smith" <JSmith@somenet.foo> | |
|
8 | To: <redmine@somenet.foo> | |
|
9 | Subject: Re: update to issue 2 | |
|
10 | Date: Sun, 22 Jun 2008 12:28:07 +0200 | |
|
11 | MIME-Version: 1.0 | |
|
12 | Content-Type: text/plain; | |
|
13 | format=flowed; | |
|
14 | charset="iso-8859-1"; | |
|
15 | reply-type=original | |
|
16 | Content-Transfer-Encoding: 7bit | |
|
17 | X-Priority: 3 | |
|
18 | X-MSMail-Priority: Normal | |
|
19 | X-Mailer: Microsoft Outlook Express 6.00.2900.2869 | |
|
20 | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 | |
|
21 | ||
|
22 | An update to the issue by the sender. | |
|
23 | ||
|
24 | Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas imperdiet | |
|
25 | turpis et odio. Integer eget pede vel dolor euismod varius. Phasellus | |
|
26 | blandit eleifend augue. Nulla facilisi. Duis id diam. Class aptent taciti | |
|
27 | sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. In | |
|
28 | in urna sed tellus aliquet lobortis. Morbi scelerisque tortor in dolor. Cras | |
|
29 | sagittis odio eu lacus. Aliquam sem tortor, consequat sit amet, vestibulum | |
|
30 | id, iaculis at, lectus. Fusce tortor libero, congue ut, euismod nec, luctus | |
|
31 | eget, eros. Pellentesque tortor enim, feugiat in, dignissim eget, tristique | |
|
32 | sed, mauris --- Pellentesque habitant morbi tristique senectus et netus et | |
|
33 | malesuada fames ac turpis egestas. Quisque sit amet libero. In hac habitasse | |
|
34 | platea dictumst. | |
|
35 | ||
|
36 | > --- Reply above. Do not remove this line. --- | |
|
37 | > | |
|
38 | > Issue #6779 has been updated by Eric Davis. | |
|
39 | > | |
|
40 | > Subject changed from Projects with JSON to Project JSON API | |
|
41 | > Status changed from New to Assigned | |
|
42 | > Assignee set to Eric Davis | |
|
43 | > Priority changed from Low to Normal | |
|
44 | > Estimated time deleted (1.00) | |
|
45 | > | |
|
46 | > Looks like the JSON api for projects was missed. I'm going to be | |
|
47 | > reviewing the existing APIs and trying to clean them up over the next | |
|
48 | > few weeks. |
@@ -318,7 +318,7 class MailHandler < ActionMailer::Base | |||
|
318 | 318 | def cleanup_body(body) |
|
319 | 319 | delimiters = Setting.mail_handler_body_delimiters.to_s.split(/[\r\n]+/).reject(&:blank?).map {|s| Regexp.escape(s)} |
|
320 | 320 | unless delimiters.empty? |
|
321 | regex = Regexp.new("^(#{ delimiters.join('|') })\s*[\r\n].*", Regexp::MULTILINE) | |
|
321 | regex = Regexp.new("^[> ]*(#{ delimiters.join('|') })\s*[\r\n].*", Regexp::MULTILINE) | |
|
322 | 322 | body = body.gsub(regex, '') |
|
323 | 323 | end |
|
324 | 324 | body.strip |
@@ -335,6 +335,38 class MailHandlerTest < ActiveSupport::TestCase | |||
|
335 | 335 | end |
|
336 | 336 | end |
|
337 | 337 | |
|
338 | context "with a single quoted reply (e.g. reply to a Redmine email notification)" do | |
|
339 | setup do | |
|
340 | Setting.mail_handler_body_delimiters = '--- Reply above. Do not remove this line. ---' | |
|
341 | end | |
|
342 | ||
|
343 | should "truncate the email at the delimiter with the quoted reply symbols (>)" do | |
|
344 | journal = submit_email('issue_update_with_quoted_reply_above.eml') | |
|
345 | assert journal.is_a?(Journal) | |
|
346 | assert journal.notes.include?('An update to the issue by the sender.') | |
|
347 | assert !journal.notes.match(Regexp.escape("--- Reply above. Do not remove this line. ---")) | |
|
348 | assert !journal.notes.include?('Looks like the JSON api for projects was missed.') | |
|
349 | ||
|
350 | end | |
|
351 | ||
|
352 | end | |
|
353 | ||
|
354 | context "with multiple quoted replies (e.g. reply to a reply of a Redmine email notification)" do | |
|
355 | setup do | |
|
356 | Setting.mail_handler_body_delimiters = '--- Reply above. Do not remove this line. ---' | |
|
357 | end | |
|
358 | ||
|
359 | should "truncate the email at the delimiter with the quoted reply symbols (>)" do | |
|
360 | journal = submit_email('issue_update_with_multiple_quoted_reply_above.eml') | |
|
361 | assert journal.is_a?(Journal) | |
|
362 | assert journal.notes.include?('An update to the issue by the sender.') | |
|
363 | assert !journal.notes.match(Regexp.escape("--- Reply above. Do not remove this line. ---")) | |
|
364 | assert !journal.notes.include?('Looks like the JSON api for projects was missed.') | |
|
365 | ||
|
366 | end | |
|
367 | ||
|
368 | end | |
|
369 | ||
|
338 | 370 | context "with multiple strings" do |
|
339 | 371 | setup do |
|
340 | 372 | Setting.mail_handler_body_delimiters = "---\nBREAK" |
General Comments 0
You need to be logged in to leave comments.
Login now