A platform for community discussion. Free, open, simple.
Add support to elide content from ProtonMail emails
Régis Hanola0386655a6d6
diff --git a/lib/email/receiver.rb b/lib/email/receiver.rbindex 09c1d2540ac..eaa9050c7a9 100644--- a/lib/email/receiver.rb+++ b/lib/email/receiver.rb@@ -301,6 +301,7 @@ module Email[:exchange, /name="message(Body|Reply)Section"/],[:apple_mail, /id="AppleMailSignature"/],[:mozilla, /class="moz-/],+ [:protonmail, /class="protonmail_/],]def extract_from_gmail(html)@@ -351,6 +352,13 @@ module Emailto_markdown(doc.to_html, elided.to_html)end+ def extract_from_protonmail(html)+ doc = Nokogiri::HTML.fragment(html)+ # Removes anything that has a class starting with "protonmail_" and everything after that+ elided = doc.css("*[class^='protonmail_'], *[class^='protonmail_'] ~ *").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)