forked from FoundKeyGang/FoundKey
make mutes case insensitive
closes FoundKeyGang/FoundKey#392 Changelog: Changed
This commit is contained in:
parent
af003fc0fe
commit
a0f0bac1ca
2 changed files with 4 additions and 2 deletions
|
@ -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(/^\/(.+)\/(.*)$/);
|
||||
|
|
|
@ -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(/^\/(.+)\/(.*)$/);
|
||||
|
|
Loading…
Reference in a new issue