From bf0b8484e2b249de05dd6d5c6c39e3743f1216cd Mon Sep 17 00:00:00 2001 From: Chathulanka Gamage Date: Mon, 4 Dec 2023 16:47:14 +0000 Subject: [PATCH 1/4] show blocked message not parsing > --- ui/site/src/forum.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/site/src/forum.ts b/ui/site/src/forum.ts index c8c43e4c2f852..65ee92c67be46 100644 --- a/ui/site/src/forum.ts +++ b/ui/site/src/forum.ts @@ -33,7 +33,7 @@ lichess.load.then(() => { $(el).replaceWith($('.forum-post__message', el)); }); $('.forum-post__message').each(function (this: HTMLElement) { - if (this.innerText.match(/(^|\n)>/)) { + if (this.innerText.match(/(^|\n|:)>/)) { const hiddenQuotes = '>'; let result = ''; let quote = []; @@ -49,7 +49,7 @@ lichess.load.then(() => { } if (quote.length > 0) result += `
${quote.join('
')}
`; this.innerHTML = result; - } + } }); $('.edit.button') From 76d9b6fa9ebc08347e203e8faae4c080d67b6d12 Mon Sep 17 00:00:00 2001 From: Chathulanka Gamage Date: Mon, 4 Dec 2023 16:58:36 +0000 Subject: [PATCH 2/4] fix whitespace --- ui/site/src/forum.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/site/src/forum.ts b/ui/site/src/forum.ts index 65ee92c67be46..6ea159b58a734 100644 --- a/ui/site/src/forum.ts +++ b/ui/site/src/forum.ts @@ -49,7 +49,7 @@ lichess.load.then(() => { } if (quote.length > 0) result += `
${quote.join('
')}
`; this.innerHTML = result; - } + } }); $('.edit.button') From 1b87442e435506f4e18ead2abf732d3ecfcfeb50 Mon Sep 17 00:00:00 2001 From: Chathulanka Gamage Date: Tue, 5 Dec 2023 07:44:21 +0000 Subject: [PATCH 3/4] use innerHtml to match if div display none --- ui/site/src/forum.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ui/site/src/forum.ts b/ui/site/src/forum.ts index 6ea159b58a734..3e70b8f2ece1d 100644 --- a/ui/site/src/forum.ts +++ b/ui/site/src/forum.ts @@ -33,7 +33,9 @@ lichess.load.then(() => { $(el).replaceWith($('.forum-post__message', el)); }); $('.forum-post__message').each(function (this: HTMLElement) { - if (this.innerText.match(/(^|\n|:)>/)) { + const isVisible = window.getComputedStyle(this).display !== 'none'; + const isMatching = isVisible ? this.innerText.match(/(^|\n)>/) : this.innerHTML.match(/(^|
)>/); + if (isMatching) { const hiddenQuotes = '>'; let result = ''; let quote = []; From 3b730f0874855a1fcf61d55ab47c0bc77933618f Mon Sep 17 00:00:00 2001 From: Thibault Duplessis Date: Tue, 5 Dec 2023 11:16:19 +0100 Subject: [PATCH 4/4] better TS check for blocked forum posts --- ui/site/src/forum.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/site/src/forum.ts b/ui/site/src/forum.ts index 3e70b8f2ece1d..cf019bb60141b 100644 --- a/ui/site/src/forum.ts +++ b/ui/site/src/forum.ts @@ -33,8 +33,8 @@ lichess.load.then(() => { $(el).replaceWith($('.forum-post__message', el)); }); $('.forum-post__message').each(function (this: HTMLElement) { - const isVisible = window.getComputedStyle(this).display !== 'none'; - const isMatching = isVisible ? this.innerText.match(/(^|\n)>/) : this.innerHTML.match(/(^|
)>/); + const isBlocked = $(this).is('.forum-post__blocked *'); + const isMatching = isBlocked ? this.innerHTML.match(/(^|
)>/) : this.innerText.match(/(^|\n)>/); if (isMatching) { const hiddenQuotes = '>'; let result = '';