Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/email_reply_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def scan_line(line)

# Mark the current Fragment as a signature if the current line is empty
# and the Fragment starts with a common signature indicator.
if @fragment && line == EMPTY
if @fragment && (is_quoted || line == EMPTY)
if SIG_REGEX.match @fragment.lines.last
@fragment.signature = true
finish_fragment
Expand Down
9 changes: 9 additions & 0 deletions test/email_reply_parser_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,15 @@ def test_do_not_parse_out_send_from_in_regular_sentence
assert_equal "Here is another email\n\nSent from my desk, is much easier then my mobile phone.", EmailReplyParser.parse_reply(body)
end

def test_parse_sent_from_inbox
reply = email(:email_sent_from_inbox)
assert_equal [false, false, true],
reply.fragments.map { |f| f.signature? }
assert_equal [false, true, true],
reply.fragments.map { |f| f.hidden? }
assert_equal "Hi,\nThis is a test reply from Inbox.", reply.visible_text
end

def test_retains_bullets
body = IO.read EMAIL_FIXTURE_PATH.join("email_bullets.txt").to_s
assert_equal "test 2 this should list second\n\nand have spaces\n\nand retain this formatting\n\n\n - how about bullets\n - and another",
Expand Down
13 changes: 13 additions & 0 deletions test/emails/email_sent_from_inbox.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Hi,
This is a test reply from Inbox.

On Wed, May 25, 2016 at 3:13 PM <[email protected]> wrote:

> LGTM
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly or view it on GitHub
>
--
Hey there, this is my signature