1
0
mirror of https://github.com/tooot-app/app synced 2025-06-05 22:19:13 +02:00

Fixed #530 thanks to ChatGPT

This commit is contained in:
xmflsct
2022-12-06 21:54:32 +01:00
parent 5239fb83c6
commit c89612d875
4 changed files with 5 additions and 7 deletions

View File

@ -72,12 +72,12 @@ export const shouldFilter = ({
const escapedPhrase = filter.phrase.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') // $& means the whole matched string
switch (filter.whole_word) {
case true:
if (new RegExp(`\\B${escapedPhrase}\\b`).test(rawContent)) {
if (new RegExp(`\\b${escapedPhrase}\\b`, 'i').test(rawContent)) {
shouldFilter = filter.phrase
}
break
case false:
if (new RegExp(escapedPhrase).test(rawContent)) {
if (new RegExp(escapedPhrase, 'i').test(rawContent)) {
shouldFilter = filter.phrase
}
break