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:
Abhinav Raut
2026-05-19 14:56:01 +05:30
parent c03477a066
commit 9dfcb6bc90
3 changed files with 16 additions and 5 deletions
@@ -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>
+2 -1
View File
@@ -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;
}
}
+6 -4
View File
@@ -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) => {