From b3bb7e2d3e2496f4e815cecbda185da230e722f6 Mon Sep 17 00:00:00 2001 From: Mm2PL Date: Mon, 9 Aug 2021 00:04:25 +0200 Subject: [PATCH 1/5] Make single deletion messages for moderators obey the setting (#3121) Co-authored-by: ALazyMeme Co-authored-by: pajlada --- CHANGELOG.md | 1 + src/Application.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c62bf8bd..e6cb014f6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) +- 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) - Dev: Renamed CMake's build option `USE_SYSTEM_QT5KEYCHAIN` to `USE_SYSTEM_QTKEYCHAIN`. (#3103) diff --git a/src/Application.cpp b/src/Application.cpp index f0f79c42f..4de581187 100644 --- a/src/Application.cpp +++ b/src/Application.cpp @@ -286,7 +286,7 @@ void Application::initPubsub() auto chan = this->twitch.server->getChannelOrEmptyByID(action.roomID); - if (chan->isEmpty()) + if (chan->isEmpty() || getSettings()->hideDeletionActions) { return; } From 75458a1a258169c4c06a811a5322bacc819a9796 Mon Sep 17 00:00:00 2001 From: Auro <35087590+MrAuro@users.noreply.github.com> Date: Sat, 14 Aug 2021 06:08:55 -0400 Subject: [PATCH 2/5] Change 3rd party uploader popup text capitalization (#3158) --- src/widgets/splits/Split.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/widgets/splits/Split.cpp b/src/widgets/splits/Split.cpp index 8c84a1476..e2cd37c7e 100644 --- a/src/widgets/splits/Split.cpp +++ b/src/widgets/splits/Split.cpp @@ -262,10 +262,11 @@ Split::Split(QWidget *parent) if (getSettings()->askOnImageUpload.getValue()) { QMessageBox msgBox; + msgBox.setWindowTitle("Chatterino"); msgBox.setText("Image upload"); msgBox.setInformativeText( "You are uploading an image to a 3rd party service not in " - "control of the chatterino team. You may not be able to " + "control of the Chatterino team. You may not be able to " "remove the image from the site. Are you okay with this?"); msgBox.addButton(QMessageBox::Cancel); msgBox.addButton(QMessageBox::Yes); From d5ecba3d3068b30eabcab2aac6e53484049585a1 Mon Sep 17 00:00:00 2001 From: fourtf Date: Sat, 14 Aug 2021 13:06:58 +0200 Subject: [PATCH 3/5] Rewrite logic for when to show moderation buttons next to messages (#2800) Co-authored-by: Rasmus Karlsson --- src/providers/twitch/TwitchMessageBuilder.cpp | 42 +++++++++---------- src/providers/twitch/TwitchMessageBuilder.hpp | 2 + 2 files changed, 21 insertions(+), 23 deletions(-) diff --git a/src/providers/twitch/TwitchMessageBuilder.cpp b/src/providers/twitch/TwitchMessageBuilder.cpp index 97c36f0d7..f91f2f742 100644 --- a/src/providers/twitch/TwitchMessageBuilder.cpp +++ b/src/providers/twitch/TwitchMessageBuilder.cpp @@ -184,29 +184,7 @@ MessagePtr TwitchMessageBuilder::build() this->emplace( calculateMessageTimestamp(this->ircMessage)); - bool addModerationElement = true; - if (this->senderIsBroadcaster) - { - addModerationElement = false; - } - else - { - bool hasUserType = this->tags.contains("user-type"); - if (hasUserType) - { - QString userType = this->tags.value("user-type").toString(); - - if (userType == "mod") - { - if (!args.isStaffOrBroadcaster) - { - addModerationElement = false; - } - } - } - } - - if (addModerationElement) + if (this->shouldAddModerationElements()) { this->emplace(); } @@ -1230,6 +1208,24 @@ Outcome TwitchMessageBuilder::tryParseCheermote(const QString &string) return Success; } +bool TwitchMessageBuilder::shouldAddModerationElements() const +{ + if (this->senderIsBroadcaster) + { + // You cannot timeout the broadcaster + return false; + } + + if (this->tags.value("user-type").toString() == "mod" && + !this->args.isStaffOrBroadcaster) + { + // You cannot timeout moderators UNLESS you are Twitch Staff or the broadcaster of the channel + return false; + } + + return true; +} + void TwitchMessageBuilder::appendChannelPointRewardMessage( const ChannelPointReward &reward, MessageBuilder *builder, bool isMod, bool isBroadcaster) diff --git a/src/providers/twitch/TwitchMessageBuilder.hpp b/src/providers/twitch/TwitchMessageBuilder.hpp index 7cf68494a..8f1217c8e 100644 --- a/src/providers/twitch/TwitchMessageBuilder.hpp +++ b/src/providers/twitch/TwitchMessageBuilder.hpp @@ -90,6 +90,8 @@ private: void appendFfzBadges(); Outcome tryParseCheermote(const QString &string); + bool shouldAddModerationElements() const; + QString roomID_; bool hasBits_ = false; QString bits; From 113a7795f426c071d6eadd393ea3b122e43de551 Mon Sep 17 00:00:00 2001 From: Marko Date: Sat, 14 Aug 2021 12:28:08 +0000 Subject: [PATCH 4/5] Hide similar messages by any user (#2716) Co-authored-by: pajlada --- CHANGELOG.md | 1 + src/providers/twitch/IrcMessageHandler.cpp | 12 ++++++------ src/singletons/Settings.hpp | 2 ++ src/widgets/settingspages/GeneralPage.cpp | 6 +++--- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e6cb014f6..9579c2c0e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/src/providers/twitch/IrcMessageHandler.cpp b/src/providers/twitch/IrcMessageHandler.cpp index 456d05223..0e720d0ee 100644 --- a/src/providers/twitch/IrcMessageHandler.cpp +++ b/src/providers/twitch/IrcMessageHandler.cpp @@ -112,11 +112,10 @@ float IrcMessageHandler::similarity( MessagePtr msg, const LimitedQueueSnapshot &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)); diff --git a/src/singletons/Settings.hpp b/src/singletons/Settings.hpp index 703fefbde..af61779f9 100644 --- a/src/singletons/Settings.hpp +++ b/src/singletons/Settings.hpp @@ -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}; diff --git a/src/widgets/settingspages/GeneralPage.cpp b/src/widgets/settingspages/GeneralPage.cpp index 0254c1360..24780ed41 100644 --- a/src/widgets/settingspages/GeneralPage.cpp +++ b/src/widgets/settingspages/GeneralPage.cpp @@ -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); From d46589ca26d6a3bfaa81d2ec0defe7e15a9a7b46 Mon Sep 17 00:00:00 2001 From: Mm2PL Date: Sat, 14 Aug 2021 15:16:16 +0200 Subject: [PATCH 5/5] Duplicate spaces now count towards the display message length (#3002) --- CHANGELOG.md | 1 + src/widgets/splits/SplitInput.cpp | 3 --- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9579c2c0e..5c8caeb71 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - 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) +- Minor: Duplicate spaces now count towards the display message length. (#3002) - 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) diff --git a/src/widgets/splits/SplitInput.cpp b/src/widgets/splits/SplitInput.cpp index 26888f365..3afe85960 100644 --- a/src/widgets/splits/SplitInput.cpp +++ b/src/widgets/splits/SplitInput.cpp @@ -639,9 +639,6 @@ void SplitInput::editTextChanged() this->textChanged.invoke(text); text = text.trimmed(); - static QRegularExpression spaceRegex("\\s\\s+"); - text = text.replace(spaceRegex, " "); - text = app->commands->execCommand(text, this->split_->getChannel(), true); }