diff --git a/CHANGELOG.md b/CHANGELOG.md index 51edeff42..4d789fb2f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,9 @@ - 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) +- 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) - 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; } 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/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; 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); 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); 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); }