diff --git a/src/messages/layouts/MessageLayout.cpp b/src/messages/layouts/MessageLayout.cpp index e80a1b2c6..a7ba26756 100644 --- a/src/messages/layouts/MessageLayout.cpp +++ b/src/messages/layouts/MessageLayout.cpp @@ -127,6 +127,11 @@ void MessageLayout::actuallyLayout(int width, MessageElementFlags _flags) for (const auto &element : this->message_->elements) { + if (getSettings()->hideModerated && + this->message_->flags.has(MessageFlag::Disabled)) + { + continue; + } element->addToContainer(*this->container_, _flags); } diff --git a/src/providers/twitch/IrcMessageHandler.cpp b/src/providers/twitch/IrcMessageHandler.cpp index be01f5b0e..d29a9c78e 100644 --- a/src/providers/twitch/IrcMessageHandler.cpp +++ b/src/providers/twitch/IrcMessageHandler.cpp @@ -261,6 +261,10 @@ void IrcMessageHandler::handleClearChatMessage(Communi::IrcMessage *message) // refresh all app->windows->repaintVisibleChatWidgets(chan.get()); + if (getSettings()->hideModerated) + { + app->windows->forceLayoutChannelViews(); + } } void IrcMessageHandler::handleUserStateMessage(Communi::IrcMessage *message) diff --git a/src/singletons/Settings.hpp b/src/singletons/Settings.hpp index ff71733cb..4d922af53 100644 --- a/src/singletons/Settings.hpp +++ b/src/singletons/Settings.hpp @@ -41,6 +41,7 @@ public: BoolSetting separateMessages = {"/appearance/messages/separateMessages", false}; BoolSetting compactEmotes = {"/appearance/messages/compactEmotes", true}; + BoolSetting hideModerated = {"/appearance/messages/hideModerated", false}; // BoolSetting collapseLongMessages = // {"/appearance/messages/collapseLongMessages", false}; diff --git a/src/widgets/settingspages/GeneralPage.cpp b/src/widgets/settingspages/GeneralPage.cpp index c0c24cc8a..cc8dfb3b9 100644 --- a/src/widgets/settingspages/GeneralPage.cpp +++ b/src/widgets/settingspages/GeneralPage.cpp @@ -213,6 +213,7 @@ void GeneralPage::initLayout(SettingsLayout &layout) layout.addCheckbox("Alternate background color", s.alternateMessages); // layout.addCheckbox("Mark last message you read"); // layout.addDropdown("Last read message style", {"Default"}); + layout.addCheckbox("Hide moderated messages", s.hideModerated); layout.addTitle("Emotes"); layout.addDropdown(