From 73ee62f55f20c2f04785e0e640f01fe250778a2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Hanol?= Date: Tue, 27 Feb 2018 15:00:50 +0100 Subject: [PATCH] FEATURE: automatically elide forwarded emails and signature from outlook --- lib/email/receiver.rb | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/lib/email/receiver.rb b/lib/email/receiver.rb index b29baf9a555..712c0e25738 100644 --- a/lib/email/receiver.rb +++ b/lib/email/receiver.rb @@ -261,8 +261,13 @@ module Email end markdown, elided_markdown = if html.present? - if html[%{
}] - html, elided_html = extract_gmail_quote(html) + if html[/
+ elided << fwd.next_element + # also elide any signatures + elided << doc.css("#Signature").remove + # remove the leading
+ [fwd.previous_element, fwd].each(&:remove) [doc.to_html, elided.to_html] end