mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-01-06 08:08:10 +08:00
fix(quote): fix more cases of unwrapped signature detection
This commit is contained in:
parent
ecb7a0e4aa
commit
5c81f083ce
7 changed files with 534 additions and 468 deletions
450
spec/fixtures/emails/email_18_stripped.html
vendored
450
spec/fixtures/emails/email_18_stripped.html
vendored
|
@ -16,453 +16,5 @@
|
|||
<div>
|
||||
<div><br>
|
||||
</div>
|
||||
<div>On Thu, Mar 3, 2016 at 3:19 AM, Nylas <span dir="ltr"><<a href="mailto:test@nylas.com" target="_blank">test@nylas.com</a>></span> wrote:<br>
|
||||
<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
|
||||
<div>Hey Recipient,
|
||||
<div>
|
||||
<div>
|
||||
<div><br>
|
||||
</div>
|
||||
</div>
|
||||
<div>Checking in -- will you guys be needing to test with 10+ accounts soon?</div>
|
||||
<span>
|
||||
<div>
|
||||
<div><br>
|
||||
</div>
|
||||
</div>
|
||||
<div>Best,</div>
|
||||
<div>Nylas</div>
|
||||
<br>
|
||||
<div>-- <br style="font-family:Nylas-Pro,Helvetica,'Lucidia Grande',sans-serif;font-size:16px;line-height:24px">
|
||||
<div style="max-width:100%;font-family:Nylas-Pro,Helvetica,'Lucidia Grande',sans-serif;font-size:15px;line-height:24px">
|
||||
<div dir="ltr" style="max-width:100%">
|
||||
<div style="max-width:100%">
|
||||
<div dir="ltr" style="max-width:100%">
|
||||
<div style="max-width:100%">
|
||||
<div dir="ltr" style="max-width:100%">
|
||||
<div dir="ltr" style="max-width:100%">
|
||||
<div dir="ltr" style="max-width:100%">
|
||||
<div dir="ltr" style="max-width:100%">
|
||||
<div dir="ltr" style="max-width:100%">
|
||||
<div dir="ltr" style="max-width:100%">
|
||||
<div style="max-width:100%">
|
||||
<div style="max-width:100%"><span style="font-weight:500">Test Sender</span></div>
|
||||
<div style="max-width:100%;font-size:12.8px">
|
||||
<div style="max-width:100%"><span style="font-size:12.8px">Head of Business Development and Growth</span></div>
|
||||
<div style="max-width:100%"><span style="font-size:12.8px">Nylas Inc.</span></div>
|
||||
<div style="max-width:100%;font-size:12.8px"><a title="tel:123" style="color:rgb(16,129,247);font-size:12.8px"></a><br>
|
||||
</div>
|
||||
<div style="max-width:100%;font-size:12.8px"><a href="https://link.nylas.com/link/8gsph0digeh6kyasmamhe4xr/1faaa7209b204b2fb0ecb16751007ec8/0?redirect=http%3A%2F%2Fwww.nylas.com%2F" title="http://www.nylas.com/" style="font-size:12.8px;color:rgb(16,129,247);background-color:rgb(255,255,255)" target="_blank">nylas.com</a></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</span></div>
|
||||
<br>
|
||||
<img width="0" height="0" style="border:0;width:0;min-height:0" src="https://link.nylas.com/open/8gsph0digeh6kyasmamhe4xr/3816aed3237c4a7abdda4c962b0e3b65">
|
||||
<div>
|
||||
<div>
|
||||
<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
|
||||
On Feb 10 2016, at 3:28 am, Recipient Name <<a href="mailto:email.name@nylas.com" target="_blank">email.name@nylas.com</a>> wrote:
|
||||
<br>
|
||||
<div dir="ltr">Fantastic! Thank you, Nylas.
|
||||
<div>
|
||||
<div><br>
|
||||
</div>
|
||||
</div>
|
||||
<div>Have a good day,</div>
|
||||
<div>Recipient</div>
|
||||
</div>
|
||||
<div>
|
||||
<div><br>
|
||||
</div>
|
||||
<div>On Wed, Feb 10, 2016 at 1:27 AM, Test Sender <span dir="ltr"><<a href="mailto:test@nylas.com" target="_blank">test@nylas.com</a>></span> wrote:<br>
|
||||
<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
|
||||
<div>Hi Recipient,
|
||||
<div>
|
||||
<div>
|
||||
<div><br>
|
||||
</div>
|
||||
</div>
|
||||
<div>CONTENT 4</div>
|
||||
<div>
|
||||
<div><br>
|
||||
</div>
|
||||
</div>
|
||||
<div>CONTENT 5</div>
|
||||
<span>
|
||||
<div>
|
||||
<div><br>
|
||||
</div>
|
||||
</div>
|
||||
<div>Best,</div>
|
||||
<div>Nylas</div>
|
||||
<div>
|
||||
<div><br>
|
||||
</div>
|
||||
</div>
|
||||
<div>-- <br style="font-family:Nylas-Pro,Helvetica,'Lucidia Grande',sans-serif;font-size:16px;line-height:24px">
|
||||
<div style="max-width:100%;font-family:Nylas-Pro,Helvetica,'Lucidia Grande',sans-serif;font-size:15px;line-height:24px">
|
||||
<div dir="ltr" style="max-width:100%">
|
||||
<div style="max-width:100%">
|
||||
<div dir="ltr" style="max-width:100%">
|
||||
<div style="max-width:100%">
|
||||
<div dir="ltr" style="max-width:100%">
|
||||
<div dir="ltr" style="max-width:100%">
|
||||
<div dir="ltr" style="max-width:100%">
|
||||
<div dir="ltr" style="max-width:100%">
|
||||
<div dir="ltr" style="max-width:100%">
|
||||
<div dir="ltr" style="max-width:100%">
|
||||
<div style="max-width:100%">
|
||||
<div style="max-width:100%"><span style="font-weight:500">Test Sender</span></div>
|
||||
<div style="max-width:100%;font-size:12.8px">
|
||||
<div style="max-width:100%"><span style="font-size:12.8px">Head of Business Development and Growth</span></div>
|
||||
<div style="max-width:100%"><span style="font-size:12.8px">Nylas Inc.</span></div>
|
||||
<div style="max-width:100%;font-size:12.8px"><a title="tel:123" style="color:rgb(16,129,247);font-size:12.8px">num</a><br>
|
||||
</div>
|
||||
<div style="max-width:100%;font-size:12.8px"><a href="http://www.nylas.com/" title="http://www.nylas.com/" style="font-size:12.8px;color:rgb(16,129,247);background-color:rgb(255,255,255)" target="_blank">nylas.com</a></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</span></div>
|
||||
<div>
|
||||
<div>
|
||||
<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
|
||||
On Feb 9 2016, at 12:49 am, Recipient Name <<a href="mailto:email.name@nylas.com" target="_blank">email.name@nylas.com</a>> wrote:
|
||||
<br>
|
||||
<div dir="ltr">Hi Nylas,
|
||||
<div>
|
||||
<div><br>
|
||||
</div>
|
||||
</div>
|
||||
<div>Content 1<br>
|
||||
<br>
|
||||
Content 2<br>
|
||||
<br>
|
||||
Regards,<br>
|
||||
Recipient</div>
|
||||
</div>
|
||||
<div>
|
||||
<div><br>
|
||||
</div>
|
||||
<div>On Tue, Feb 9, 2016 at 1:37 AM, Test Sender <span dir="ltr"><<a href="mailto:test@nylas.com" target="_blank">test@nylas.com</a>></span> wrote:<br>
|
||||
<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
|
||||
<div>Thanks APerson!
|
||||
<div>
|
||||
<div>
|
||||
<div><br>
|
||||
</div>
|
||||
</div>
|
||||
<div>Content 3
|
||||
</div>
|
||||
<span>
|
||||
<div>
|
||||
<div><br>
|
||||
</div>
|
||||
</div>
|
||||
<div>Best,</div>
|
||||
<div>Nylas</div>
|
||||
<br>
|
||||
<div>-- <br style="font-family:Nylas-Pro,Helvetica,'Lucidia Grande',sans-serif;font-size:16px;line-height:24px">
|
||||
<div style="max-width:100%;font-family:Nylas-Pro,Helvetica,'Lucidia Grande',sans-serif;font-size:15px;line-height:24px">
|
||||
<div dir="ltr" style="max-width:100%">
|
||||
<div style="max-width:100%">
|
||||
<div dir="ltr" style="max-width:100%">
|
||||
<div style="max-width:100%">
|
||||
<div dir="ltr" style="max-width:100%">
|
||||
<div dir="ltr" style="max-width:100%">
|
||||
<div dir="ltr" style="max-width:100%">
|
||||
<div dir="ltr" style="max-width:100%">
|
||||
<div dir="ltr" style="max-width:100%">
|
||||
<div dir="ltr" style="max-width:100%">
|
||||
<div style="max-width:100%">
|
||||
<div style="max-width:100%"><span style="font-weight:500">Test Sender</span></div>
|
||||
<div style="max-width:100%;font-size:12.8px">
|
||||
<div style="max-width:100%"><span style="font-size:12.8px">Head of Business Development and Growth</span></div>
|
||||
<div style="max-width:100%"><span style="font-size:12.8px">Nylas Inc.</span></div>
|
||||
<div style="max-width:100%;font-size:12.8px"><a title="tel:123" style="color:rgb(16,129,247);font-size:12.8px">num</a><br>
|
||||
</div>
|
||||
<div style="max-width:100%;font-size:12.8px"><a href="http://www.nylas.com/" title="http://www.nylas.com/" style="font-size:12.8px;color:rgb(16,129,247);background-color:rgb(255,255,255)" target="_blank">nylas.com</a></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</span></div>
|
||||
<div>
|
||||
<div>
|
||||
<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
|
||||
On Feb 8 2016, at 3:33 pm, Another Person <<a href="mailto:another.email@nylas.com" target="_blank">another.email@nylas.com</a>> wrote:
|
||||
<br>
|
||||
<div dir="ltr">CONTENT 8
|
||||
<div>
|
||||
<div><br>
|
||||
</div>
|
||||
</div>
|
||||
<div>Regards,</div>
|
||||
<div>APerson</div>
|
||||
<div>
|
||||
<div><br>
|
||||
</div>
|
||||
<div>
|
||||
<div>
|
||||
<div dir="ltr">
|
||||
<div>
|
||||
<div dir="ltr">
|
||||
<div>
|
||||
<div dir="ltr"><span style="border-collapse:collapse;color:rgb(136,136,136);font-family:arial,sans-serif;font-size:13px">
|
||||
<div>
|
||||
<div>
|
||||
<div>Another Person</div>
|
||||
<div>Co-founder & President of Pipedrive</div>
|
||||
<div><a value="+14153200885">(415) 320-0885</a></div>
|
||||
<div><a href="http://linkedin.com/in/timorein" style="color:rgb(0,0,204)" target="_blank">linkedin.com/in/timorein</a></div>
|
||||
<div><a href="http://www.pipedrive.com/" style="color:rgb(0,0,204)" target="_blank">www.pipedrive.com</a></div>
|
||||
</div>
|
||||
</div>
|
||||
</span></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<div>On Mon, Feb 8, 2016 at 2:27 PM, Test Sender <span dir="ltr"><<a href="mailto:test@nylas.com" target="_blank">test@nylas.com</a>></span> wrote:<br>
|
||||
<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
|
||||
<div>Hi APerson,
|
||||
<div>
|
||||
<div>
|
||||
<div><br>
|
||||
</div>
|
||||
</div>
|
||||
<div>CONTENT 9</div>
|
||||
<div>
|
||||
<div><br>
|
||||
</div>
|
||||
</div>
|
||||
<div>CONTENT 10</div>
|
||||
<div>
|
||||
<div><br>
|
||||
</div>
|
||||
</div>
|
||||
<div>Best,</div>
|
||||
<div>
|
||||
<div><br>
|
||||
</div>
|
||||
</div>
|
||||
<div>Nylas<span><span></span></span></div>
|
||||
<span>
|
||||
<div>
|
||||
<div><br>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<div>-- <br style="font-family:Nylas-Pro,Helvetica,'Lucidia Grande',sans-serif;font-size:16px;line-height:24px">
|
||||
<div style="max-width:100%;font-family:Nylas-Pro,Helvetica,'Lucidia Grande',sans-serif;font-size:15px;line-height:24px">
|
||||
<div dir="ltr" style="max-width:100%">
|
||||
<div style="max-width:100%">
|
||||
<div dir="ltr" style="max-width:100%">
|
||||
<div style="max-width:100%">
|
||||
<div dir="ltr" style="max-width:100%">
|
||||
<div dir="ltr" style="max-width:100%">
|
||||
<div dir="ltr" style="max-width:100%">
|
||||
<div dir="ltr" style="max-width:100%">
|
||||
<div dir="ltr" style="max-width:100%">
|
||||
<div dir="ltr" style="max-width:100%">
|
||||
<div style="max-width:100%">
|
||||
<div style="max-width:100%"><span style="font-weight:500">Test Sender</span></div>
|
||||
<div style="max-width:100%;font-size:12.8px">
|
||||
<div style="max-width:100%"><span style="font-size:12.8px">Head of Business Development and Growth</span></div>
|
||||
<div style="max-width:100%"><span style="font-size:12.8px">Nylas Inc.</span></div>
|
||||
<div style="max-width:100%;font-size:12.8px"><a title="tel:123" style="color:rgb(16,129,247);font-size:12.8px">num</a><br>
|
||||
</div>
|
||||
<div style="max-width:100%;font-size:12.8px"><a href="http://www.nylas.com/" title="http://www.nylas.com/" style="font-size:12.8px;color:rgb(16,129,247);background-color:rgb(255,255,255)" target="_blank">nylas.com</a></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</span></div>
|
||||
<div>
|
||||
<div>
|
||||
<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
|
||||
On Feb 8 2016, at 1:40 pm, Another Person <<a href="mailto:another.email@nylas.com" target="_blank">another.email@nylas.com</a>> wrote:
|
||||
<br>
|
||||
<div dir="ltr">Hey Nylas,
|
||||
<div>
|
||||
<div><br>
|
||||
</div>
|
||||
</div>
|
||||
<div>CONTENT 11</div>
|
||||
<div>
|
||||
<div><br>
|
||||
</div>
|
||||
</div>
|
||||
<div>CONTENT 12<br>
|
||||
<br>
|
||||
<blockquote style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
|
||||
<div style="font-size:12.8px">CONTENT 13</div>
|
||||
<div style="font-size:12.8px">
|
||||
<div><br>
|
||||
</div>
|
||||
CONTENT 14</div>
|
||||
</blockquote>
|
||||
<div>
|
||||
<div><br>
|
||||
</div>
|
||||
</div>
|
||||
<div>CONTENT 15</div>
|
||||
<div>
|
||||
<div><br>
|
||||
</div>
|
||||
</div>
|
||||
<div>Regards,</div>
|
||||
<div>APerson </div>
|
||||
</div>
|
||||
<div>
|
||||
<div><br>
|
||||
</div>
|
||||
<div>
|
||||
<div>
|
||||
<div dir="ltr">
|
||||
<div>
|
||||
<div dir="ltr">
|
||||
<div>
|
||||
<div dir="ltr"><span style="border-collapse:collapse;color:rgb(136,136,136);font-family:arial,sans-serif;font-size:13px">
|
||||
<div>
|
||||
<div>
|
||||
<div>Another Person</div>
|
||||
<div>Co-founder & President of Place</div>
|
||||
<div><a value="+14153200885">num</a></div>
|
||||
<div><a href="http://linkedin.com/in/test" style="color:rgb(0,0,204)" target="_blank">linkedin.com/in/test</a></div>
|
||||
<div><a href="http://www.nylas.com/" style="color:rgb(0,0,204)" target="_blank">www.nylas.com</a></div>
|
||||
</div>
|
||||
</div>
|
||||
</span></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</blockquote>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</blockquote>
|
||||
</div>
|
||||
<br>
|
||||
</div>
|
||||
</div>
|
||||
</blockquote>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</blockquote>
|
||||
</div>
|
||||
<br>
|
||||
<br>
|
||||
<div>
|
||||
<div><br>
|
||||
</div>
|
||||
</div>
|
||||
-- <br>
|
||||
<div>
|
||||
<div dir="ltr">
|
||||
<div>
|
||||
<div dir="ltr">Test Person</div>
|
||||
<div>Product Manager | Pipedrive</div>
|
||||
<div>@testtwitter</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</blockquote>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</blockquote>
|
||||
</div>
|
||||
<br>
|
||||
<br>
|
||||
<div>
|
||||
<div><br>
|
||||
</div>
|
||||
</div>
|
||||
-- <br>
|
||||
<div>
|
||||
<div dir="ltr">
|
||||
<div>
|
||||
<div dir="ltr">Test Person</div>
|
||||
<div>Product Manager | Pipedrive</div>
|
||||
<div>@testtwitter</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</blockquote>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</blockquote>
|
||||
</div>
|
||||
<br>
|
||||
<br>
|
||||
<div><br>
|
||||
</div>
|
||||
-- <br>
|
||||
<div>
|
||||
<div dir="ltr">
|
||||
<div>
|
||||
<div dir="ltr">Test Person</div>
|
||||
<div>Product Manager | Pipedrive</div>
|
||||
<div>@testtwitter</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</body>
|
||||
</div></div></body>
|
3
spec/fixtures/emails/email_20_stripped.html
vendored
3
spec/fixtures/emails/email_20_stripped.html
vendored
|
@ -1,2 +1 @@
|
|||
<div dir="ltr">Yaaay! So excited :) And no worries, see you in PR, if not before</div><div class="gmail_extra"><br><br><br clear="all"><div><br></div><br>
|
||||
</div>
|
||||
<div dir="ltr">Yaaay! So excited :) And no worries, see you in PR, if not before</div><div class="gmail_extra"><br></div>
|
484
spec/fixtures/emails/email_23.html
vendored
Normal file
484
spec/fixtures/emails/email_23.html
vendored
Normal file
|
@ -0,0 +1,484 @@
|
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><div dir="ltr"><div class="gmail_default" style="font-family:tahoma,sans-serif">Hi,</div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">Thank you</div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">Text</div><div class="gmail_default" style="font-family:tahoma,sans-serif">Text</div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">Thank you again,</div><div class="gmail_default" style="font-family:tahoma,sans-serif">Name</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Nov 3, 2016 at 3:34 PM, Evan Morikawa <span dir="ltr"><<a href="mailto:evan@nylas.com" target="_blank">evan@nylas.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
|
||||
|
||||
|
||||
|
||||
<div>
|
||||
Name,
|
||||
<div style="max-width:100%;font-family:Nylas-Pro,Helvetica,"Lucidia Grande",sans-serif;font-size:14.5px">
|
||||
<div style="max-width:100%"><br>
|
||||
</div>
|
||||
<div style="max-width:100%">Text A</div>
|
||||
<div style="max-width:100%"><br>
|
||||
</div>
|
||||
<div style="max-width:100%">Text B</div>
|
||||
<div style="max-width:100%"><br>
|
||||
</div>
|
||||
<div style="max-width:100%">Text C</div>
|
||||
<div style="max-width:100%"><br>
|
||||
</div>
|
||||
<div style="max-width:100%">Text D</div>
|
||||
<div style="max-width:100%"><br>
|
||||
</div>
|
||||
<div style="max-width:100%">Best,</div>
|
||||
<div style="max-width:100%">Evan</div>
|
||||
<div style="max-width:100%"><a href="tel:%28858%29%20531-1718" value="+18585311718" target="_blank">(858) 531-1718</a></div>
|
||||
</div>
|
||||
<img class="m_4916245491697320432n1-open" width="0" height="0" style="border:0;width:0;height:0" src="https://link.nylas.com/open/e7pdeb1ninvdy61tg6liermf8/local-2ac86b20-5e8a"><div><div class="h5">
|
||||
<div class="gmail_quote m_4916245491697320432nylas-quote m_4916245491697320432nylas-quote-id-9j8cw553wjdknnnrrypxr794v"><br>
|
||||
On Nov 1 2016, at 11:21 am, Halla Moore <<a href="mailto:Halla@nylas.com" target="_blank">Halla@nylas.com</a>> wrote: <br>
|
||||
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
|
||||
|
||||
Hi Name,
|
||||
<div>
|
||||
<div><br>
|
||||
</div>
|
||||
<div>Nice to e-meet you too! :)</div>
|
||||
</div>
|
||||
<div><br>
|
||||
</div>
|
||||
<div>Speak to you soon,</div>
|
||||
<div>Halla</div>
|
||||
<div><br>
|
||||
On Nov 1 2016, at 11:18 am, Last, Name <<a href="mailto:name_wu@brown.edu" target="_blank">name_wu@brown.edu</a>> wrote: <br>
|
||||
<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
|
||||
|
||||
<div dir="ltr">
|
||||
<div style="font-family:tahoma,sans-serif">Hi Evan and Halla,</div>
|
||||
<div style="font-family:tahoma,sans-serif"><br>
|
||||
</div>
|
||||
<div style="font-family:tahoma,sans-serif">Halla -- nice to e-meet you! I'm looking forward to speaking. :)</div>
|
||||
<div style="font-family:tahoma,sans-serif"><br>
|
||||
</div>
|
||||
<div style="font-family:tahoma,sans-serif">Thank you,</div>
|
||||
<div style="font-family:tahoma,sans-serif">Name</div>
|
||||
</div>
|
||||
<div><br>
|
||||
<div>On Tue, Nov 1, 2016 at 1:42 PM, Evan Morikawa <span dir="ltr"><<a href="mailto:evan@nylas.com" target="_blank">evan@nylas.com</a>></span> wrote:<br>
|
||||
<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
|
||||
<div>Name,
|
||||
<div><br>
|
||||
</div>
|
||||
<div>Text J</div>
|
||||
<div><br>
|
||||
</div>
|
||||
<div>You should also get a calendar invite shortly.</div>
|
||||
<div><br>
|
||||
</div>
|
||||
<div>Evan</div>
|
||||
<img width="0" height="0" style="border:0;width:0;height:0" src="https://link.nylas.com/open/e7pdeb1ninvdy61tg6liermf8/local-2a3d3a3d-a321">
|
||||
<div>
|
||||
<div>
|
||||
<div><br>
|
||||
On Oct 31 2016, at 5:22 pm, Last, Name <<a href="mailto:name_wu@brown.edu" target="_blank">name_wu@brown.edu</a>> wrote:
|
||||
<br>
|
||||
<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
|
||||
<div dir="ltr">
|
||||
<div style="font-family:tahoma,sans-serif">Hi Evan,</div>
|
||||
<div style="font-family:tahoma,sans-serif"><br>
|
||||
</div>
|
||||
<div style="font-family:tahoma,sans-serif">Yes, that works! Looking forward to it.</div>
|
||||
<div style="font-family:tahoma,sans-serif"><br>
|
||||
</div>
|
||||
<div style="font-family:tahoma,sans-serif">Name</div>
|
||||
</div>
|
||||
<div><br>
|
||||
<div>On Mon, Oct 31, 2016 at 2:49 PM, Evan Morikawa <span dir="ltr"><<a href="mailto:evan@nylas.com" target="_blank">evan@nylas.com</a>></span> wrote:<br>
|
||||
<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
|
||||
<div>Name, how about tomorrow, Tuesday 11/1 at 7:00pm EDT (4:00pm PDT)?<br>
|
||||
<br>
|
||||
Evan<img width="0" height="0" style="border:0;width:0;height:0" src="https://link.nylas.com/open/e7pdeb1ninvdy61tg6liermf8/local-42953eac-36c9">
|
||||
<div>
|
||||
<div>
|
||||
<div><br>
|
||||
On Oct 28 2016, at 10:16 am, Last, Name <<a href="mailto:name_wu@brown.edu" target="_blank">name_wu@brown.edu</a>> wrote:
|
||||
<br>
|
||||
<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
|
||||
<div dir="ltr">
|
||||
<div style="font-family:tahoma,sans-serif">Hi Evan,</div>
|
||||
<div style="font-family:tahoma,sans-serif"><br>
|
||||
</div>
|
||||
<div style="font-family:tahoma,sans-serif">Thank you for your patience; I've been recovering from a cold this week.</div>
|
||||
<div style="font-family:tahoma,sans-serif"><br>
|
||||
</div>
|
||||
<div style="font-family:tahoma,sans-serif">Text H</div>
|
||||
<div style="font-family:tahoma,sans-serif"><br>
|
||||
</div>
|
||||
<div style="font-family:tahoma,sans-serif">Thank you very much,</div>
|
||||
<div style="font-family:tahoma,sans-serif">Name</div>
|
||||
<div><br>
|
||||
<div>On Tue, Oct 25, 2016 at 11:51 AM, Evan Morikawa <span dir="ltr"><<a href="mailto:evan@nylas.com" target="_blank">evan@nylas.com</a>></span> wrote:<br>
|
||||
<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
|
||||
<div>Name,
|
||||
<div><br>
|
||||
</div>
|
||||
<div>Text I</div>
|
||||
<div><br>
|
||||
</div>
|
||||
<div>Text J</div>
|
||||
<div><br>
|
||||
</div>
|
||||
<div>Text K</div>
|
||||
<div><br>
|
||||
</div>
|
||||
<div>Really looking forward to chatting more soon.</div>
|
||||
<div><br>
|
||||
</div>
|
||||
<div>Evan</div>
|
||||
<img width="0" height="0" style="border:0;width:0;height:0" src="https://link.nylas.com/open/e7pdeb1ninvdy61tg6liermf8/local-d5253a11-8753">
|
||||
<div>
|
||||
<div>
|
||||
<div><br>
|
||||
On Oct 24 2016, at 11:54 pm, Last, Name <<a href="mailto:name_wu@brown.edu" target="_blank">name_wu@brown.edu</a>> wrote:
|
||||
<br>
|
||||
<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
|
||||
<div dir="ltr">
|
||||
<div style="font-family:tahoma,sans-serif">Hello Evan,</div>
|
||||
<div style="font-family:tahoma,sans-serif"><br>
|
||||
</div>
|
||||
<div style="font-family:tahoma,sans-serif">Text L</div>
|
||||
<div style="font-family:tahoma,sans-serif"><br>
|
||||
</div>
|
||||
<div style="font-family:tahoma,sans-serif">Cheers,</div>
|
||||
<div style="font-family:tahoma,sans-serif">Name</div>
|
||||
</div>
|
||||
<div><br>
|
||||
<div>On Wed, Oct 19, 2016 at 5:59 PM, Last, Name <span dir="ltr"><<a href="mailto:name_wu@brown.edu" target="_blank">name_wu@brown.edu</a>></span> wrote:<br>
|
||||
<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
|
||||
<div dir="ltr">Hi Evan,
|
||||
<div><br>
|
||||
</div>
|
||||
<div>Text M</div>
|
||||
<span>
|
||||
<div><br>
|
||||
</div>
|
||||
<div>Name</div>
|
||||
</span></div>
|
||||
<div>
|
||||
<div>
|
||||
<div><br>
|
||||
<div>On Wed, Oct 19, 2016 at 12:40 PM, Evan Morikawa <span dir="ltr"><<a href="mailto:evan@nylas.com" target="_blank">evan@nylas.com</a>></span> wrote:<br>
|
||||
<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
|
||||
<div>Great!
|
||||
<div>
|
||||
<div><br>
|
||||
</div>
|
||||
<div>I just sent over a calendar invite. Join me on this Google Hangout: <a href="https://plus.google.com/hangouts/_/nylas.com/evan-name" target="_blank">https://plus.google.c<wbr>om/hangouts/_/nylas.com/evan-j<wbr>ulia</a> this
|
||||
Friday.</div>
|
||||
<div><br>
|
||||
</div>
|
||||
<div>Talk soon</div>
|
||||
<span>
|
||||
<div>Evan</div>
|
||||
<div><a value="+18585311718">(858) 531-1718</a></div>
|
||||
<br>
|
||||
<u></u>Sent from <a href="https://link.nylas.com/link/e7pdeb1ninvdy61tg6liermf8/local-d0981f11-53c7/0?redirect=https%3A%2F%2Fnylas.com%2Fn1%3Fref%3Dn1" target="_blank">
|
||||
Nylas N1</a>, the extensible, open source mail client.<u></u></span></div>
|
||||
<img width="0" height="0" style="border:0;width:0;height:0" src="https://link.nylas.com/open/e7pdeb1ninvdy61tg6liermf8/local-d0981f11-53c7">
|
||||
<div>
|
||||
<div>
|
||||
<div><br>
|
||||
On Oct 18 2016, at 7:21 pm, Last, Name <<a href="mailto:name_wu@brown.edu" target="_blank">name_wu@brown.edu</a>> wrote:
|
||||
<br>
|
||||
<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
|
||||
<div dir="ltr">Hi Evan,
|
||||
<div><br>
|
||||
</div>
|
||||
<div>Sounds great! My number is <a value="+555555">555-5555</a>.</div>
|
||||
<div><br>
|
||||
</div>
|
||||
<div>Looking forward to speaking,</div>
|
||||
<div>Name</div>
|
||||
</div>
|
||||
<div><br>
|
||||
<div>On Tue, Oct 18, 2016 at 4:12 PM, Evan Morikawa <span dir="ltr"><<a href="mailto:evan@nylas.com" target="_blank">evan@nylas.com</a>></span> wrote:<br>
|
||||
<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
|
||||
<div>Name, (Michael to bcc),
|
||||
<div>
|
||||
<div><br>
|
||||
</div>
|
||||
<div>Friday works. How about 30 min this Friday 10/21 at 11:30am PDT (2:30pm EDT)?</div>
|
||||
<div><br>
|
||||
</div>
|
||||
<div>Evan</div>
|
||||
<span><br>
|
||||
<u></u>Sent from <a href="https://link.nylas.com/link/e7pdeb1ninvdy61tg6liermf8/local-aee34b8e-af74/0?redirect=https%3A%2F%2Fnylas.com%2Fn1%3Fref%3Dn1" target="_blank">
|
||||
Nylas N1</a>, the extensible, open source mail client.<u></u></span></div>
|
||||
<img width="0" height="0" style="border:0;width:0;height:0" src="https://link.nylas.com/open/e7pdeb1ninvdy61tg6liermf8/local-aee34b8e-af74">
|
||||
<div>
|
||||
<div>
|
||||
<div><br>
|
||||
On Oct 18 2016, at 2:03 pm, Last, Name <<a href="mailto:name_wu@brown.edu" target="_blank">name_wu@brown.edu</a>> wrote:
|
||||
<br>
|
||||
<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
|
||||
<div dir="ltr">Hi Evan,
|
||||
<div><br>
|
||||
</div>
|
||||
<div>Text N</div>
|
||||
<div>Text O</div>
|
||||
<div><br>
|
||||
</div>
|
||||
<div>Thanks a lot,</div>
|
||||
<div>Name</div>
|
||||
<div><br>
|
||||
<div>On Mon, Oct 17, 2016 at 1:24 PM, Evan Morikawa <span dir="ltr"><<a href="mailto:evan@nylas.com" target="_blank">evan@nylas.com</a>></span> wrote:<br>
|
||||
<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
|
||||
<div>Juila,
|
||||
<div>
|
||||
<div><br>
|
||||
</div>
|
||||
<div>Text P</div>
|
||||
<div><br>
|
||||
</div>
|
||||
<div>Have time early this week?</div>
|
||||
<div><br>
|
||||
</div>
|
||||
<div>Evan</div>
|
||||
<span>
|
||||
<div><a value="+18585311718">(858) 531-1718</a></div>
|
||||
<br>
|
||||
<u></u>Sent from <a href="https://link.nylas.com/link/e7pdeb1ninvdy61tg6liermf8/local-8427e727-d342/0?redirect=https%3A%2F%2Fnylas.com%2Fn1%3Fref%3Dn1" target="_blank">
|
||||
Nylas N1</a>, the extensible, open source mail client.<u></u></span></div>
|
||||
<img width="0" height="0" style="border:0;width:0;height:0" src="https://link.nylas.com/open/e7pdeb1ninvdy61tg6liermf8/local-8427e727-d342">
|
||||
<div>
|
||||
<div>
|
||||
<div><br>
|
||||
On Oct 7 2016, at 9:17 am, Last, Name <<a href="mailto:name_wu@brown.edu" target="_blank">name_wu@brown.edu</a>> wrote:
|
||||
<br>
|
||||
<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
|
||||
<div dir="ltr">Hi Evan,
|
||||
<div><br>
|
||||
</div>
|
||||
<div>Text Q</div>
|
||||
<div><br>
|
||||
</div>
|
||||
<div>Text R</div>
|
||||
<div><br>
|
||||
</div>
|
||||
<div>I look forward to staying in touch. :)</div>
|
||||
<div><br>
|
||||
</div>
|
||||
<div>Thank you very much,</div>
|
||||
<div>Name</div>
|
||||
<div><br>
|
||||
</div>
|
||||
</div>
|
||||
<div><br>
|
||||
<div>On Mon, Oct 3, 2016 at 5:17 PM, Evan Morikawa <span dir="ltr"><<a href="mailto:evan@nylas.com" target="_blank">evan@nylas.com</a>></span> wrote:<br>
|
||||
<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
|
||||
<div><span>Name</span>,
|
||||
<div>
|
||||
<div><br>
|
||||
</div>
|
||||
<div>Text S</div>
|
||||
<div><br>
|
||||
</div>
|
||||
<div>Evan</div>
|
||||
<div>Nylas</div>
|
||||
<div><a value="+18585311718">(858) 531-1718</a></div>
|
||||
<br>
|
||||
<u></u>Sent from <a href="https://link.nylas.com/link/e7pdeb1ninvdy61tg6liermf8/local-87ed2e6b-3158/0?redirect=https%3A%2F%2Fnylas.com%2Fn1%3Fref%3Dn1" target="_blank">
|
||||
Nylas N1</a>, the extensible, open source mail client.<u></u></div>
|
||||
<img width="0" height="0" style="border:0;width:0;min-height:0" src="https://link.nylas.com/open/e7pdeb1ninvdy61tg6liermf8/local-87ed2e6b-3158">
|
||||
</div>
|
||||
</blockquote>
|
||||
</div>
|
||||
<br>
|
||||
<br>
|
||||
<div><br>
|
||||
</div>
|
||||
-- <br>
|
||||
<div>
|
||||
<div dir="ltr">
|
||||
<div>
|
||||
<div dir="ltr">Name Last
|
||||
<div>Sc.B., Some Major</div>
|
||||
<div>Some University | Class of 2028</div>
|
||||
<div><a href="http://www.linkedin.com/pub/name-wu/83/528/b67" target="_blank"><img src="https://static.licdn.com/scds/common/u/img/webpromo/btn_profile_bluetxt_80x15.png"></a><br>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</blockquote>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</blockquote>
|
||||
</div>
|
||||
<br>
|
||||
<br>
|
||||
<div><br>
|
||||
</div>
|
||||
-- <br>
|
||||
<div>
|
||||
<div dir="ltr">
|
||||
<div>
|
||||
<div dir="ltr">Name Last
|
||||
<div>Sc.B., Some Major</div>
|
||||
<div>Some University | Class of 2028</div>
|
||||
<div><a href="http://www.linkedin.com/pub/name-wu/83/528/b67" target="_blank"><img src="https://static.licdn.com/scds/common/u/img/webpromo/btn_profile_bluetxt_80x15.png"></a><br>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</blockquote>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</blockquote>
|
||||
</div>
|
||||
<br>
|
||||
<br>
|
||||
<div><br>
|
||||
</div>
|
||||
-- <br>
|
||||
<div>
|
||||
<div dir="ltr">
|
||||
<div>
|
||||
<div dir="ltr">Name Last
|
||||
<div>Sc.B., Some Major</div>
|
||||
<div>Some University | Class of 2028</div>
|
||||
<div><a href="http://www.linkedin.com/pub/name-wu/83/528/b67" target="_blank"><img src="https://static.licdn.com/scds/common/u/img/webpromo/btn_profile_bluetxt_80x15.png"></a><br>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</blockquote>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</blockquote>
|
||||
</div>
|
||||
<br>
|
||||
<br>
|
||||
<div><br>
|
||||
</div>
|
||||
-- <br>
|
||||
<div>
|
||||
<div dir="ltr">
|
||||
<div>
|
||||
<div dir="ltr">Name Last
|
||||
<div>Sc.B., Some Major</div>
|
||||
<div>Some University | Class of 2028</div>
|
||||
<div><a href="http://www.linkedin.com/pub/name-wu/83/528/b67" target="_blank"><img src="https://static.licdn.com/scds/common/u/img/webpromo/btn_profile_bluetxt_80x15.png"></a><br>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</blockquote>
|
||||
</div>
|
||||
<br>
|
||||
<br>
|
||||
<div><br>
|
||||
</div>
|
||||
-- <br>
|
||||
<div>
|
||||
<div dir="ltr">
|
||||
<div>
|
||||
<div dir="ltr">Name Last
|
||||
<div>Sc.B., Some Major</div>
|
||||
<div>Some University | Class of 2028</div>
|
||||
<div><a href="http://www.linkedin.com/pub/name-wu/83/528/b67" target="_blank"><img src="https://static.licdn.com/scds/common/u/img/webpromo/btn_profile_bluetxt_80x15.png"></a><br>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</blockquote>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</blockquote>
|
||||
</div>
|
||||
<br>
|
||||
<br>
|
||||
<div><br>
|
||||
</div>
|
||||
-- <br>
|
||||
<div>
|
||||
<div dir="ltr">
|
||||
<div>
|
||||
<div dir="ltr">Name Last
|
||||
<div>Sc.B., Some Major</div>
|
||||
<div>Some University | Class of 2028</div>
|
||||
<div><a href="http://www.linkedin.com/pub/name-wu/83/528/b67" target="_blank"><img src="https://static.licdn.com/scds/common/u/img/webpromo/btn_profile_bluetxt_80x15.png"></a><br>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</blockquote>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</blockquote>
|
||||
</div>
|
||||
<br>
|
||||
<br>
|
||||
<div><br>
|
||||
</div>
|
||||
-- <br>
|
||||
<div>
|
||||
<div dir="ltr">
|
||||
<div>
|
||||
<div dir="ltr">Name Last
|
||||
<div>Sc.B., Some Major</div>
|
||||
<div>Some University | Class of 2028</div>
|
||||
<div><a href="http://www.linkedin.com/pub/name-wu/83/528/b67" target="_blank"><img src="https://static.licdn.com/scds/common/u/img/webpromo/btn_profile_bluetxt_80x15.png"></a><br>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</blockquote>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</blockquote>
|
||||
</div>
|
||||
<br>
|
||||
<br>
|
||||
<div><br>
|
||||
</div>
|
||||
-- <br>
|
||||
<div>
|
||||
<div dir="ltr">
|
||||
<div>
|
||||
<div dir="ltr">Name Last
|
||||
<div>Sc.B., Some Major</div>
|
||||
<div>Some University | Class of 2028</div>
|
||||
<div><a href="http://www.linkedin.com/pub/name-wu/83/528/b67" target="_blank"><img src="https://static.licdn.com/scds/common/u/img/webpromo/btn_profile_bluetxt_80x15.png"></a><br>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</blockquote>
|
||||
</div>
|
||||
</blockquote>
|
||||
</div>
|
||||
</div></div></div>
|
||||
|
||||
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr">Name Last<div>Sc.B., Some Major</div><div>Some University | Class of 2028</div><div><a href="http://www.linkedin.com/pub/name-wu/83/528/b67" target="_blank"><img src="https://static.licdn.com/scds/common/u/img/webpromo/btn_profile_bluetxt_80x15.png"></a><br></div></div></div></div></div>
|
||||
</div>
|
1
spec/fixtures/emails/email_23_stripped.html
vendored
Normal file
1
spec/fixtures/emails/email_23_stripped.html
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
<div dir="ltr"><div class="gmail_default" style="font-family:tahoma,sans-serif">Hi,</div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">Thank you</div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">Text</div><div class="gmail_default" style="font-family:tahoma,sans-serif">Text</div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">Thank you again,</div><div class="gmail_default" style="font-family:tahoma,sans-serif">Name</div></div><div class="gmail_extra"><br></div>
|
|
@ -19,7 +19,7 @@ describe "QuotedHTMLTransformer", ->
|
|||
re = new RegExp(QuotedHTMLTransformer.annotationClass, 'g')
|
||||
html.match(re)?.length ? 0
|
||||
|
||||
[1..22].forEach (n) ->
|
||||
[1..23].forEach (n) ->
|
||||
it "properly parses email_#{n}", ->
|
||||
opts = keepIfWholeBodyIsQuote: true
|
||||
expect(removeQuotedHTML("email_#{n}.html", opts).trim()).toEqual(readFile("email_#{n}_stripped.html").trim())
|
||||
|
@ -405,7 +405,7 @@ describe "QuotedHTMLTransformer", ->
|
|||
# `QuotedHTMLTransformer` needs Electron booted up in order to work because
|
||||
# of the DOMParser.
|
||||
xit "Run this simple function to generate output files", ->
|
||||
[22].forEach (n) ->
|
||||
[18, 20].forEach (n) ->
|
||||
newHTML = QuotedHTMLTransformer.removeQuotedHTML(readFile("email_#{n}.html"))
|
||||
outPath = path.resolve(__dirname, '..', 'fixtures', 'emails', "email_#{n}_raw_stripped.html")
|
||||
fs.writeFileSync(outPath, newHTML)
|
||||
|
|
|
@ -164,17 +164,36 @@ class QuotedHTMLTransformer {
|
|||
* message. We detect this case (by looking for signature text
|
||||
* repetition) and add it to the set of flagged quote candidates.
|
||||
*/
|
||||
quoteElements = quoteElements.concat(unwrappedSignatureDetector(doc, quoteElements))
|
||||
const unwrappedSignatureNodes = unwrappedSignatureDetector(doc, quoteElements)
|
||||
quoteElements = quoteElements.concat(unwrappedSignatureNodes)
|
||||
|
||||
if (!includeInline && quoteElements.length > 0) {
|
||||
// This means we only want to remove quoted text that shows up at the
|
||||
// end of a message. If there were non quoted content after, it'd be
|
||||
// inline.
|
||||
|
||||
const trailingQuotes = this._findTrailingQuotes(doc, Array.from(quoteElements));
|
||||
|
||||
// Only keep the trailing quotes so we can delete them.
|
||||
/**
|
||||
* The _findTrailingQuotes method will return an array of the quote
|
||||
* elements we should remove. If there was no trailing text, it
|
||||
* should include all of the existing VISIBLE quoteElements. If
|
||||
* there was trailing text, it will only include the quote elements
|
||||
* up to that trailling text. The intersection below will only
|
||||
* mark the quote elements below trailing text ot be deleted.
|
||||
*/
|
||||
quoteElements = _.intersection(quoteElements, trailingQuotes);
|
||||
|
||||
/**
|
||||
* The _findTraillingQuotes method only preserves VISIBLE elements.
|
||||
* It's possible that the unwrappedSignatureDetector discovered a
|
||||
* collection of nodes with both visible and not visible (like br)
|
||||
* content. If we're going to get rid of trailing signatures we
|
||||
* need to also remove those trailling <br/>s, or we can get a bunch
|
||||
* of blank space at the end of the text. First make sure that some
|
||||
* of our unwrappedSignatureNodes were marked for deletion, and then
|
||||
* make sure we include all of them.
|
||||
*/
|
||||
if (_.intersection(quoteElements, unwrappedSignatureNodes).length > 0) {
|
||||
quoteElements = _.uniq(quoteElements.concat(unwrappedSignatureNodes))
|
||||
}
|
||||
}
|
||||
|
||||
return _.compact(_.uniq(quoteElements));
|
||||
|
@ -192,6 +211,8 @@ class QuotedHTMLTransformer {
|
|||
* unique text that a user wrote. We return at that point assuming that
|
||||
* everything at the text and above should be visible, even if it's a
|
||||
* quoted text candidate.
|
||||
*
|
||||
* See email_18 and email_23 and unwrapped-signature-detector
|
||||
*/
|
||||
_findTrailingQuotes(scopeElement, quoteElements = []) {
|
||||
let trailingQuotes = [];
|
||||
|
|
|
@ -23,21 +23,30 @@ function textAndNodesAfterNode(node) {
|
|||
* it looks very similar to someone writing inline regular text after some
|
||||
* quoted text (which is allowed).
|
||||
*
|
||||
* See email_20 and email_21 as a test case for this.
|
||||
* See email_18, email_20, email_21, and email_23 test cases for this.
|
||||
*/
|
||||
export default function unwrappedSignatureDetector(doc, quoteElements) {
|
||||
// Find the last quoteBlock
|
||||
for (const node of DOMWalkers.walkBackwards(doc)) {
|
||||
if (quoteElements.includes(node)) {
|
||||
const {text, nodes} = textAndNodesAfterNode(node);
|
||||
const maybeSig = text.trim();
|
||||
if (maybeSig.length > 0) {
|
||||
if ((node.textContent || "").search(Utils.escapeRegExp(maybeSig)) >= 0) {
|
||||
return nodes;
|
||||
}
|
||||
}
|
||||
break;
|
||||
let textAndNodes;
|
||||
let focusNode = node;
|
||||
if (node && quoteElements.includes(node)) {
|
||||
textAndNodes = textAndNodesAfterNode(node);
|
||||
} else if (node.previousSibling && quoteElements.includes(node.previousSibling)) {
|
||||
focusNode = node.previousSibling;
|
||||
textAndNodes = textAndNodesAfterNode(node.previousSibling);
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
|
||||
const {text, nodes} = textAndNodes;
|
||||
const maybeSig = text.replace(/\s/g, "");
|
||||
if (maybeSig.length > 0) {
|
||||
if ((focusNode.textContent || "").replace(/\s/g, "").search(Utils.escapeRegExp(maybeSig)) >= 0) {
|
||||
return nodes;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return []
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue