Hide similar messages by any user (#2716)

Co-authored-by: pajlada <rasmus.karlsson@pajlada.com>
This commit is contained in:
Marko 2021-08-14 12:28:08 +00:00 committed by GitHub
parent d5ecba3d30
commit 113a7795f4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 9 deletions

View file

@ -5,6 +5,7 @@
- Minor: Remove TwitchEmotes.com attribution and the open/copy options when right-clicking a Twitch Emote. (#2214, #3136)
- Minor: Strip leading @ and trailing , from username in /user and /usercard commands. (#3143)
- Minor: Display a system message when reloading subscription emotes to match BTTV/FFZ behavior (#3135)
- Minor: Added a setting to hide similar messages by any user. (#2716)
- Bugfix: Notifications for moderators about other moderators deleting messages can now be disabled. (#3121)
- Bugfix: Moderation mode and active filters are now preserved when opening a split as a popup. (#3113, #3130)
- Bugfix: Fixed a bug that caused all badge highlights to use the same color. (#3132, #3134)

View file

@ -112,11 +112,10 @@ float IrcMessageHandler::similarity(
MessagePtr msg, const LimitedQueueSnapshot<MessagePtr> &messages)
{
float similarityPercent = 0.0f;
int bySameUser = 0;
for (int i = 1; bySameUser < getSettings()->hideSimilarMaxMessagesToCheck;
++i)
int checked = 0;
for (int i = 1; i <= messages.size(); ++i)
{
if (messages.size() < i)
if (checked >= getSettings()->hideSimilarMaxMessagesToCheck)
{
break;
}
@ -126,11 +125,12 @@ float IrcMessageHandler::similarity(
{
break;
}
if (msg->loginName != prevMsg->loginName)
if (getSettings()->hideSimilarBySameUser &&
msg->loginName != prevMsg->loginName)
{
continue;
}
++bySameUser;
++checked;
similarityPercent = std::max(
similarityPercent,
relativeSimilarity(msg->messageText, prevMsg->messageText));

View file

@ -392,6 +392,8 @@ public:
BoolSetting colorSimilarDisabled = {"/similarity/colorSimilarDisabled",
true};
BoolSetting hideSimilar = {"/similarity/hideSimilar", false};
BoolSetting hideSimilarBySameUser = {"/similarity/hideSimilarBySameUser",
true};
BoolSetting hideSimilarMyself = {"/similarity/hideSimilarMyself", false};
BoolSetting shownSimilarTriggerHighlights = {
"/similarity/shownSimilarTriggerHighlights", false};

View file

@ -520,11 +520,11 @@ void GeneralPage::initLayout(GeneralPageView &layout)
layout.addCheckbox("Title", s.headerStreamTitle);
layout.addSubtitle("R9K");
layout.addDescription(
"Hide similar messages by the same user. Toggle hidden "
"messages by pressing Ctrl+H.");
layout.addDescription("Hide similar messages. Toggle hidden "
"messages by pressing Ctrl+H.");
layout.addCheckbox("Hide similar messages", s.similarityEnabled);
//layout.addCheckbox("Gray out matches", s.colorSimilarDisabled);
layout.addCheckbox("By the same user", s.hideSimilarBySameUser);
layout.addCheckbox("Hide my own messages", s.hideSimilarMyself);
layout.addCheckbox("Receive notification sounds from hidden messages",
s.shownSimilarTriggerHighlights);