From c89612d87510fb389bfec4708fa64e9f71a91f08 Mon Sep 17 00:00:00 2001 From: xmflsct Date: Tue, 6 Dec 2022 21:54:32 +0100 Subject: [PATCH] Fixed #530 thanks to ChatGPT --- fastlane/metadata/en-US/release_notes.txt | 3 +-- fastlane/metadata/zh-Hans/release_notes.txt | 3 +-- package.json | 2 +- src/components/Timeline/Shared/Filtered.tsx | 4 ++-- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/fastlane/metadata/en-US/release_notes.txt b/fastlane/metadata/en-US/release_notes.txt index 12b2cab0..a9c58068 100644 --- a/fastlane/metadata/en-US/release_notes.txt +++ b/fastlane/metadata/en-US/release_notes.txt @@ -1,3 +1,2 @@ Enjoy toooting! This version includes following improvements and fixes: -- Fix toot attribution of favourites etc. -- Fix switching language \ No newline at end of file +- Fix whole word filter matching \ No newline at end of file diff --git a/fastlane/metadata/zh-Hans/release_notes.txt b/fastlane/metadata/zh-Hans/release_notes.txt index 51453bd1..17c7b65f 100644 --- a/fastlane/metadata/zh-Hans/release_notes.txt +++ b/fastlane/metadata/zh-Hans/release_notes.txt @@ -1,3 +1,2 @@ toooting愉快!此版本包括以下改进和修复: -- 修复嘟文收藏等显示 -- 修复不能切换语言 \ No newline at end of file +- 修复过滤整词功能 \ No newline at end of file diff --git a/package.json b/package.json index b822761c..50527daa 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tooot", - "version": "4.6.6", + "version": "4.7.0", "description": "tooot for Mastodon", "author": "xmflsct ", "license": "GPL-3.0-or-later", diff --git a/src/components/Timeline/Shared/Filtered.tsx b/src/components/Timeline/Shared/Filtered.tsx index e370d585..a9495366 100644 --- a/src/components/Timeline/Shared/Filtered.tsx +++ b/src/components/Timeline/Shared/Filtered.tsx @@ -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