make mutes case insensitive
ci/woodpecker/push/lint-client Pipeline failed Details
ci/woodpecker/push/lint-backend Pipeline failed Details
ci/woodpecker/push/build Pipeline was successful Details
ci/woodpecker/push/lint-foundkey-js Pipeline was successful Details
ci/woodpecker/push/lint-sw Pipeline failed Details
ci/woodpecker/push/test Pipeline failed Details

closes #392

Changelog: Changed
This commit is contained in:
Johann150 2023-05-31 12:58:50 +02:00
parent af003fc0fe
commit a0f0bac1ca
Signed by: Johann150
GPG Key ID: 9EE6577A2A06F8F1
2 changed files with 4 additions and 2 deletions

View File

@ -20,10 +20,11 @@ export async function checkWordMute(note: NoteLike, me: UserLike | null | undefi
const text = ((note.cw ?? '') + '\n' + (note.text ?? '')).trim();
if (text === '') return false;
const textLower = text.toLowerCase();
const matched = mutedWords.some(filter => {
if (Array.isArray(filter)) {
return filter.every(keyword => text.includes(keyword));
return filter.every(keyword => textLower.includes(keyword.toLowerCase()));
} else {
// represents RegExp
const regexp = filter.match(/^\/(.+)\/(.*)$/);

View File

@ -6,6 +6,7 @@ export function checkWordMute(note: Record<string, any>, me: Record<string, any>
const text = ((note.cw ?? '') + '\n' + (note.text ?? '')).trim();
if (text === '') return false;
const textLower = text.toLowerCase();
const matched = mutedWords.some(filter => {
if (Array.isArray(filter)) {
@ -13,7 +14,7 @@ export function checkWordMute(note: Record<string, any>, me: Record<string, any>
const filteredFilter = filter.filter(keyword => keyword !== '');
if (filteredFilter.length === 0) return false;
return filteredFilter.every(keyword => text.includes(keyword));
return filteredFilter.every(keyword => textLower.includes(keyword.toLowerCase()));
} else {
// represents RegExp
const regexp = filter.match(/^\/(.+)\/(.*)$/);