mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 22:05:48 +08:00
FIX: less aggressive gmail eliding
This commit is contained in:
parent
448e2fe1a2
commit
8a53941fe0
|
@ -301,7 +301,7 @@ module Email
|
|||
end
|
||||
|
||||
HTML_EXTRACTERS ||= [
|
||||
[:gmail, /class="gmail_(?!default)/],
|
||||
[:gmail, /class="gmail_(signature|extra)/],
|
||||
[:outlook, /id="(divRplyFwdMsg|Signature)"/],
|
||||
[:word, /class="WordSection1"/],
|
||||
[:exchange, /name="message(Body|Reply)Section"/],
|
||||
|
@ -313,9 +313,8 @@ module Email
|
|||
]
|
||||
|
||||
def extract_from_gmail(doc)
|
||||
# GMail adds a bunch of 'gmail_' prefixed classes like: gmail_signature, gmail_extra, gmail_quote
|
||||
# Just elide them all except for 'gmail_default'
|
||||
elided = doc.css("*[class^='gmail_']:not([class*='gmail_default'])").remove
|
||||
# GMail adds a bunch of 'gmail_' prefixed classes like: gmail_signature, gmail_extra, gmail_quote, gmail_default...
|
||||
elided = doc.css(".gmail_signature, .gmail_extra").remove
|
||||
to_markdown(doc.to_html, elided.to_html)
|
||||
end
|
||||
|
||||
|
|
2
spec/fixtures/emails/gmail_html_reply.eml
vendored
2
spec/fixtures/emails/gmail_html_reply.eml
vendored
|
@ -11,7 +11,7 @@ Content-Transfer-Encoding: quoted-printable
|
|||
<div dir="auto">
|
||||
<p>This is a <b>GMAIL</b> reply ;)</p>
|
||||
</div>
|
||||
<div class="gmail_quote">
|
||||
<div class="gmail_signature">
|
||||
<p>This is the <i>elided</i> part!</p>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue
Block a user