ミュートワードで正規表現を使えるように

This commit is contained in:
syuilo 2019-02-16 19:37:05 +09:00
parent 890770c275
commit ec3ca3032e
No known key found for this signature in database
GPG Key ID: BDC4C49D06AB9D69

View File

@ -4,7 +4,8 @@ export default function(me, settings, note) {
const includesMutedWords = (text: string) =>
text
? settings.mutedWords.some(q => q.length > 0 && !q.some(word => !text.includes(word)))
? settings.mutedWords.some(q => q.length > 0 && !q.some(word =>
word.startsWith('/') && word.endsWith('/') ? !(new RegExp(word.substr(1, word.length - 2)).test(text)) : !text.includes(word)))
: false;
return (