Skip to content

Commit

Permalink
censor parent message if from blocked user
Browse files Browse the repository at this point in the history
  • Loading branch information
2547techno committed Apr 2, 2023
1 parent b209c50 commit 5d1f002
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
24 changes: 23 additions & 1 deletion src/providers/twitch/TwitchMessageBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,18 @@ bool TwitchMessageBuilder::isIgnored() const
});
}

bool TwitchMessageBuilder::isIgnoredReply() const
{
return isIgnoredMessage({
/*.message = */ this->originalMessage_,
/*.twitchUserID = */
this->tags.value("reply-parent-user-id")
.toString(),
/*.isMod = */ this->channel->isMod(),
/*.isBroadcaster = */ this->channel->isBroadcaster(),
});
}

void TwitchMessageBuilder::triggerHighlights()
{
if (this->historicalMessage_)
Expand Down Expand Up @@ -623,7 +635,17 @@ void TwitchMessageBuilder::parseThread()
replyBody != this->tags.end())
{
auto name = replyDisplayName->toString();
auto body = parseTagString(replyBody->toString());
QString body;
if (this->isIgnoredReply())
{
qCDebug(chatterinoTwitch) << "blocked reply";
body = QString("*Blocked message*");
}
else
{
qCDebug(chatterinoTwitch) << "NOT blocked reply";
body = parseTagString(replyBody->toString());
}

this->emplace<ReplyCurveElement>();

Expand Down
1 change: 1 addition & 0 deletions src/providers/twitch/TwitchMessageBuilder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class TwitchMessageBuilder : public SharedMessageBuilder
TwitchChannel *twitchChannel;

[[nodiscard]] bool isIgnored() const override;
bool isIgnoredReply() const;
void triggerHighlights() override;
MessagePtr build() override;

Expand Down

0 comments on commit 5d1f002

Please sign in to comment.