mirror of
https://github.com/tooot-app/app
synced 2025-01-20 21:10:33 +01:00
Fix whole word filter not working
This commit is contained in:
parent
f96e9af7b9
commit
44d1f6fbed
@ -46,7 +46,7 @@ export const shouldFilter = ({
|
||||
let shouldFilter = false
|
||||
if (!ownAccount) {
|
||||
const parser = new htmlparser2.Parser({
|
||||
ontext (text: string) {
|
||||
ontext: (text: string) => {
|
||||
const checkFilter = (filter: Mastodon.Filter) => {
|
||||
const escapedPhrase = filter.phrase.replace(
|
||||
/[.*+?^${}()|[\]\\]/g,
|
||||
@ -54,7 +54,7 @@ export const shouldFilter = ({
|
||||
) // $& means the whole matched string
|
||||
switch (filter.whole_word) {
|
||||
case true:
|
||||
if (new RegExp('\\b' + escapedPhrase + '\\b').test(text)) {
|
||||
if (new RegExp('\\B' + escapedPhrase + '\\B').test(text)) {
|
||||
shouldFilter = true
|
||||
}
|
||||
break
|
||||
|
Loading…
Reference in New Issue
Block a user