fix: stop blocked terms from showing up more than once (#5789)
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
- Bugfix: Fixed 7TV usernames messing with Qt's HTML (#5780)
|
||||
- Bugfix: Fixed BTTV emotes occasionally showing the wrong author. (#5783)
|
||||
- Bugfix: Fixed some Twitch emotes containing HTML entities. (#5786)
|
||||
- Bugfix: Fixed the same blocked term showing up more than once. (#5789)
|
||||
- Dev: Hard-code Boost 1.86.0 in macos CI builders. (#5774)
|
||||
|
||||
## 2.5.2-beta.1
|
||||
|
||||
@@ -495,12 +495,12 @@ void TwitchIrcServer::initialize()
|
||||
PubSubAutoModQueueMessage::Reason::BlockedTerm)
|
||||
{
|
||||
auto numBlockedTermsMatched =
|
||||
msg.blockedTermsFound.count();
|
||||
msg.blockedTermsFound.size();
|
||||
auto hideBlockedTerms =
|
||||
getSettings()
|
||||
->streamerModeHideBlockedTermText &&
|
||||
getApp()->getStreamerMode()->isEnabled();
|
||||
if (!msg.blockedTermsFound.isEmpty())
|
||||
if (!msg.blockedTermsFound.empty())
|
||||
{
|
||||
if (hideBlockedTerms)
|
||||
{
|
||||
@@ -513,14 +513,16 @@ void TwitchIrcServer::initialize()
|
||||
}
|
||||
else
|
||||
{
|
||||
QStringList blockedTerms(
|
||||
msg.blockedTermsFound.begin(),
|
||||
msg.blockedTermsFound.end());
|
||||
action.reason =
|
||||
u"matches %1 blocked term%2 \"%3\""_s
|
||||
.arg(numBlockedTermsMatched)
|
||||
.arg(numBlockedTermsMatched > 1
|
||||
? u"s"
|
||||
: u"")
|
||||
.arg(msg.blockedTermsFound.join(
|
||||
u"\", \""));
|
||||
.arg(blockedTerms.join(u"\", \""));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -60,7 +60,7 @@ PubSubAutoModQueueMessage::PubSubAutoModQueueMessage(const QJsonObject &root)
|
||||
const auto termText = term.value("text").toString();
|
||||
if (!termText.isEmpty())
|
||||
{
|
||||
this->blockedTermsFound.push_back(termText);
|
||||
this->blockedTermsFound.insert(termText);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
|
||||
#include <set>
|
||||
|
||||
namespace chatterino {
|
||||
|
||||
struct PubSubAutoModQueueMessage {
|
||||
@@ -41,7 +43,7 @@ struct PubSubAutoModQueueMessage {
|
||||
QString senderUserDisplayName;
|
||||
QColor senderUserChatColor;
|
||||
|
||||
QStringList blockedTermsFound;
|
||||
std::set<QString> blockedTermsFound;
|
||||
|
||||
PubSubAutoModQueueMessage() = default;
|
||||
explicit PubSubAutoModQueueMessage(const QJsonObject &root);
|
||||
|
||||
Reference in New Issue
Block a user