mirror of
https://github.com/discourse/discourse.git
synced 2025-03-06 03:09:43 +00:00
FIX: less aggressive gmail eliding
This commit is contained in:
parent
448e2fe1a2
commit
8a53941fe0
@ -301,7 +301,7 @@ module Email
|
|||||||
end
|
end
|
||||||
|
|
||||||
HTML_EXTRACTERS ||= [
|
HTML_EXTRACTERS ||= [
|
||||||
[:gmail, /class="gmail_(?!default)/],
|
[:gmail, /class="gmail_(signature|extra)/],
|
||||||
[:outlook, /id="(divRplyFwdMsg|Signature)"/],
|
[:outlook, /id="(divRplyFwdMsg|Signature)"/],
|
||||||
[:word, /class="WordSection1"/],
|
[:word, /class="WordSection1"/],
|
||||||
[:exchange, /name="message(Body|Reply)Section"/],
|
[:exchange, /name="message(Body|Reply)Section"/],
|
||||||
@ -313,9 +313,8 @@ module Email
|
|||||||
]
|
]
|
||||||
|
|
||||||
def extract_from_gmail(doc)
|
def extract_from_gmail(doc)
|
||||||
# GMail adds a bunch of 'gmail_' prefixed classes like: gmail_signature, gmail_extra, gmail_quote
|
# GMail adds a bunch of 'gmail_' prefixed classes like: gmail_signature, gmail_extra, gmail_quote, gmail_default...
|
||||||
# Just elide them all except for 'gmail_default'
|
elided = doc.css(".gmail_signature, .gmail_extra").remove
|
||||||
elided = doc.css("*[class^='gmail_']:not([class*='gmail_default'])").remove
|
|
||||||
to_markdown(doc.to_html, elided.to_html)
|
to_markdown(doc.to_html, elided.to_html)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
BIN
spec/fixtures/emails/gmail_html_reply.eml
vendored
BIN
spec/fixtures/emails/gmail_html_reply.eml
vendored
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user