From 2b0e5051219c0059378adf9988cc4754998c1bd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Hanol?= Date: Thu, 19 Apr 2018 12:39:55 +0200 Subject: [PATCH] Extract signatures from emails sent with Newton --- lib/email/receiver.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/email/receiver.rb b/lib/email/receiver.rb index a390c2061da..8de43f4b3ab 100644 --- a/lib/email/receiver.rb +++ b/lib/email/receiver.rb @@ -304,6 +304,7 @@ module Email [:mozilla, / class="moz-/], [:protonmail, / class="protonmail_/], [:zimbra, / data-marker="__/], + [:newton, /(id|class)="cm_/], ] def extract_from_gmail(doc) @@ -360,6 +361,12 @@ module Email to_markdown(doc.to_html, elided.to_html) end + def extract_from_newton(doc) + # Removes anything that has an id or a class starting with 'cm_' + elided = doc.css("*[id^='cm_'], *[class^='cm_']").remove + to_markdown(doc.to_html, elided.to_html) + end + def trim_reply_and_extract_elided(text) return [text, ""] if @opts[:skip_trimming] EmailReplyTrimmer.trim(text, true)