Add flags.similar filter variable (#5747)

This commit is contained in:
Mm2PL
2024-12-01 15:22:35 +01:00
committed by GitHub
parent 14776deb35
commit 06d0160b35
4 changed files with 16 additions and 7 deletions
+1
View File
@@ -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 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: Added a setting to hide the scrollbar highlights. (#5732)
- Minor: The window layout is now backed up like the other settings. (#5647) - 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: 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: 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) - Bugfix: Fixed restricted users usernames not being clickable. (#5405)
+2
View File
@@ -36,6 +36,7 @@ const QMap<QString, Type> MESSAGE_TYPING_CONTEXT{
{"flags.restricted", Type::Bool}, {"flags.restricted", Type::Bool},
{"flags.monitored", Type::Bool}, {"flags.monitored", Type::Bool},
{"flags.shared", Type::Bool}, {"flags.shared", Type::Bool},
{"flags.similar", Type::Bool},
{"message.content", Type::String}, {"message.content", Type::String},
{"message.length", Type::Int}, {"message.length", Type::Int},
{"reward.title", Type::String}, {"reward.title", Type::String},
@@ -144,6 +145,7 @@ ContextMap buildContextMap(const MessagePtr &m, chatterino::Channel *channel)
{"flags.restricted", m->flags.has(MessageFlag::RestrictedMessage)}, {"flags.restricted", m->flags.has(MessageFlag::RestrictedMessage)},
{"flags.monitored", m->flags.has(MessageFlag::MonitoredMessage)}, {"flags.monitored", m->flags.has(MessageFlag::MonitoredMessage)},
{"flags.shared", m->flags.has(MessageFlag::SharedMessage)}, {"flags.shared", m->flags.has(MessageFlag::SharedMessage)},
{"flags.similar", m->flags.has(MessageFlag::Similar)},
{"message.content", m->messageText}, {"message.content", m->messageText},
{"message.length", m->messageText.length()}, {"message.length", m->messageText.length()},
@@ -44,6 +44,7 @@ const QMap<QString, QString> VALID_IDENTIFIERS_MAP{
{"flags.restricted", "restricted message?"}, {"flags.restricted", "restricted message?"},
{"flags.monitored", "monitored message?"}, {"flags.monitored", "monitored message?"},
{"flags.shared", "shared message?"}, {"flags.shared", "shared message?"},
{"flags.similar", "r9k filtered message?"},
{"message.content", "message text"}, {"message.content", "message text"},
{"message.length", "message length"}, {"message.length", "message length"},
{"reward.title", "point reward title"}, {"reward.title", "point reward title"},
+12 -7
View File
@@ -945,13 +945,14 @@ void GeneralPage::initLayout(GeneralPageView &layout)
toggleLocalr9kShortcut = toggleLocalr9kSeq.toString( toggleLocalr9kShortcut = toggleLocalr9kSeq.toString(
QKeySequence::SequenceFormat::NativeText); QKeySequence::SequenceFormat::NativeText);
} }
layout.addDescription("Hide similar messages. Toggle hidden " layout.addDescription(
"messages by pressing " + "Hide similar messages to those previously seen. Toggle hidden "
toggleLocalr9kShortcut + "."); "messages by pressing " +
layout.addCheckbox("Hide similar messages", s.similarityEnabled); toggleLocalr9kShortcut + ".");
layout.addCheckbox("Enable similarity checks", s.similarityEnabled);
//layout.addCheckbox("Gray out matches", s.colorSimilarDisabled); //layout.addCheckbox("Gray out matches", s.colorSimilarDisabled);
layout.addCheckbox( 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 " "When checked, messages that are very similar to each other can still "
"be shown as long as they're sent by different users."); "be shown as long as they're sent by different users.");
layout.addCheckbox("Hide my own messages", s.hideSimilarMyself); layout.addCheckbox("Hide my own messages", s.hideSimilarMyself);
@@ -968,7 +969,7 @@ void GeneralPage::initLayout(GeneralPageView &layout)
return QString::number(val); return QString::number(val);
}, },
[](auto args) { [](auto args) {
return fuzzyToFloat(args.value, 0.9f); return fuzzyToFloat(args.value, 0.9F);
}, },
true, true,
"A value of 0.9 means the messages need to be 90% similar to be marked " "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) { [](auto args) {
return fuzzyToInt(args.value, 3); 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.addSubtitle("Visible badges");
layout.addCheckbox("Authority", s.showBadgesGlobalAuthority, false, layout.addCheckbox("Authority", s.showBadgesGlobalAuthority, false,