diff --git a/CHANGELOG.md b/CHANGELOG.md index 4c0b0f21..4c4d6c0f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -47,6 +47,7 @@ - Minor: Added a setting to hide the scrollbar thumb (the handle you can drag). Hiding the scrollbar thumb will disable mouse click & drag interactions in the scrollbar. (#5731) - Minor: Added a setting to hide the scrollbar highlights. (#5732) - Minor: The window layout is now backed up like the other settings. (#5647) +- Minor: Added `flags.similar` filter variable, allowing you to filter messages filtered by the R9K feature. (#5747) - Bugfix: Fixed tab move animation occasionally failing to start after closing a tab. (#5426, #5612) - Bugfix: If a network request errors with 200 OK, Qt's error code is now reported instead of the HTTP status. (#5378) - Bugfix: Fixed restricted users usernames not being clickable. (#5405) diff --git a/src/controllers/filters/lang/Filter.cpp b/src/controllers/filters/lang/Filter.cpp index a2e79150..57e45539 100644 --- a/src/controllers/filters/lang/Filter.cpp +++ b/src/controllers/filters/lang/Filter.cpp @@ -36,6 +36,7 @@ const QMap MESSAGE_TYPING_CONTEXT{ {"flags.restricted", Type::Bool}, {"flags.monitored", Type::Bool}, {"flags.shared", Type::Bool}, + {"flags.similar", Type::Bool}, {"message.content", Type::String}, {"message.length", Type::Int}, {"reward.title", Type::String}, @@ -144,6 +145,7 @@ ContextMap buildContextMap(const MessagePtr &m, chatterino::Channel *channel) {"flags.restricted", m->flags.has(MessageFlag::RestrictedMessage)}, {"flags.monitored", m->flags.has(MessageFlag::MonitoredMessage)}, {"flags.shared", m->flags.has(MessageFlag::SharedMessage)}, + {"flags.similar", m->flags.has(MessageFlag::Similar)}, {"message.content", m->messageText}, {"message.length", m->messageText.length()}, diff --git a/src/controllers/filters/lang/Tokenizer.cpp b/src/controllers/filters/lang/Tokenizer.cpp index 5e9d1137..4b8890fe 100644 --- a/src/controllers/filters/lang/Tokenizer.cpp +++ b/src/controllers/filters/lang/Tokenizer.cpp @@ -44,6 +44,7 @@ const QMap VALID_IDENTIFIERS_MAP{ {"flags.restricted", "restricted message?"}, {"flags.monitored", "monitored message?"}, {"flags.shared", "shared message?"}, + {"flags.similar", "r9k filtered message?"}, {"message.content", "message text"}, {"message.length", "message length"}, {"reward.title", "point reward title"}, diff --git a/src/widgets/settingspages/GeneralPage.cpp b/src/widgets/settingspages/GeneralPage.cpp index e85582fa..1c92fa9b 100644 --- a/src/widgets/settingspages/GeneralPage.cpp +++ b/src/widgets/settingspages/GeneralPage.cpp @@ -945,13 +945,14 @@ void GeneralPage::initLayout(GeneralPageView &layout) toggleLocalr9kShortcut = toggleLocalr9kSeq.toString( QKeySequence::SequenceFormat::NativeText); } - layout.addDescription("Hide similar messages. Toggle hidden " - "messages by pressing " + - toggleLocalr9kShortcut + "."); - layout.addCheckbox("Hide similar messages", s.similarityEnabled); + layout.addDescription( + "Hide similar messages to those previously seen. Toggle hidden " + "messages by pressing " + + toggleLocalr9kShortcut + "."); + layout.addCheckbox("Enable similarity checks", s.similarityEnabled); //layout.addCheckbox("Gray out matches", s.colorSimilarDisabled); layout.addCheckbox( - "By the same user", s.hideSimilarBySameUser, false, + "Only if by the same user", s.hideSimilarBySameUser, false, "When checked, messages that are very similar to each other can still " "be shown as long as they're sent by different users."); layout.addCheckbox("Hide my own messages", s.hideSimilarMyself); @@ -968,7 +969,7 @@ void GeneralPage::initLayout(GeneralPageView &layout) return QString::number(val); }, [](auto args) { - return fuzzyToFloat(args.value, 0.9f); + return fuzzyToFloat(args.value, 0.9F); }, true, "A value of 0.9 means the messages need to be 90% similar to be marked " @@ -993,7 +994,11 @@ void GeneralPage::initLayout(GeneralPageView &layout) }, [](auto args) { return fuzzyToInt(args.value, 3); - }); + }, + true, + "How many messages in the history should be compared to a new one to " + "establish its similarity rating. Messages in the history will be " + "compared to only if they are new enough."); layout.addSubtitle("Visible badges"); layout.addCheckbox("Authority", s.showBadgesGlobalAuthority, false,