mirror of
https://github.com/abhinavxd/libredesk.git
synced 2026-09-11 13:28:57 +00:00
fix: hide Gmail forward quoted text
Gmail forwards wrap content in <div class="gmail_quote gmail_quote_container"> instead of a blockquote, so the existing detector missed them.
This commit is contained in:
@@ -51,6 +51,14 @@ describe('containsQuoteMarkers', () => {
|
||||
expect(containsQuoteMarkers(html)).toBe(true)
|
||||
})
|
||||
|
||||
test('detects Gmail forward gmail_quote_container', () => {
|
||||
const html = `<div class="gmail_quote gmail_quote_container">
|
||||
<div dir="ltr" class="gmail_attr">---------- Forwarded message ---------</div>
|
||||
<div>Original message body</div>
|
||||
</div>`
|
||||
expect(containsQuoteMarkers(html)).toBe(true)
|
||||
})
|
||||
|
||||
test('detects real Hotmail reply payload', () => {
|
||||
const html = `<div class="elementToProof">Quoted reply!</div>
|
||||
<div id="appendonsend"></div>
|
||||
|
||||
@@ -311,7 +311,8 @@
|
||||
[id$="_OLK_SRC_BODY_SECTION"] ~ *,
|
||||
[class*="_OutlookMessageHeader"],
|
||||
[class*="_OutlookMessageHeader"] ~ *,
|
||||
[class*="_yahoo_quoted"] {
|
||||
[class*="_yahoo_quoted"],
|
||||
[class*="_gmail_quote_container"] {
|
||||
@apply hidden;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,16 +3,18 @@
|
||||
// render time, so any CSS that needs to match the rendered DOM must use
|
||||
// attribute-suffix selectors (see .hide-quoted-text in main.scss).
|
||||
//
|
||||
// Scope: <blockquote> covers Gmail/Apple/Thunderbird. The id/class markers
|
||||
// below cover the Microsoft variants (Outlook desktop/web/mac, Hotmail)
|
||||
// and Yahoo Mail.
|
||||
// Scope: <blockquote> covers Gmail/Apple/Thunderbird *replies*. Gmail
|
||||
// *forwards* wrap content in <div class="gmail_quote gmail_quote_container">
|
||||
// instead. The id/class markers below cover the Microsoft variants
|
||||
// (Outlook desktop/web/mac, Hotmail) and Yahoo Mail.
|
||||
export const QUOTE_MARKERS = [
|
||||
'<blockquote',
|
||||
'id="divRplyFwdMsg"',
|
||||
'id="appendonsend"',
|
||||
'id="OLK_SRC_BODY_SECTION"',
|
||||
'class="OutlookMessageHeader"',
|
||||
'class="yahoo_quoted"'
|
||||
'class="yahoo_quoted"',
|
||||
'gmail_quote_container'
|
||||
]
|
||||
|
||||
export const containsQuoteMarkers = (html) => {
|
||||
|
||||
Reference in New Issue
Block a user