Fix: check reply-parent-user-id for blocked user (#4502)

This commit is contained in:
2547techno
2023-04-13 12:13:49 -04:00
committed by GitHub
parent fe2b82bc7b
commit 52a6f259cf
3 changed files with 28 additions and 7 deletions
+1
View File
@@ -9,6 +9,7 @@
- Minor: Added the ability to reply to a message by `Shift + Right Click`ing the username. (#4424) - Minor: Added the ability to reply to a message by `Shift + Right Click`ing the username. (#4424)
- Minor: Added better filter validation and error messages. (#4364) - Minor: Added better filter validation and error messages. (#4364)
- Minor: Updated the look of the Black Theme to be more in line with the other themes. (#4523) - Minor: Updated the look of the Black Theme to be more in line with the other themes. (#4523)
- Minor: Reply context now censors blocked users. (#4502)
- Bugfix: Fixed an issue where animated emotes would render on top of zero-width emotes. (#4314) - Bugfix: Fixed an issue where animated emotes would render on top of zero-width emotes. (#4314)
- Bugfix: Fixed an issue where it was difficult to hover a zero-width emote. (#4314) - Bugfix: Fixed an issue where it was difficult to hover a zero-width emote. (#4314)
- Bugfix: Fixed an issue where context-menu items for zero-width emotes displayed the wrong provider. (#4460) - Bugfix: Fixed an issue where context-menu items for zero-width emotes displayed the wrong provider. (#4460)
+26 -7
View File
@@ -157,6 +157,17 @@ 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() void TwitchMessageBuilder::triggerHighlights()
{ {
if (this->historicalMessage_) if (this->historicalMessage_)
@@ -622,19 +633,27 @@ void TwitchMessageBuilder::parseThread()
if (replyDisplayName != this->tags.end() && if (replyDisplayName != this->tags.end() &&
replyBody != this->tags.end()) replyBody != this->tags.end())
{ {
auto name = replyDisplayName->toString(); QString body;
auto body = parseTagString(replyBody->toString());
this->emplace<ReplyCurveElement>(); this->emplace<ReplyCurveElement>();
this->emplace<TextElement>( this->emplace<TextElement>(
"Replying to", MessageElementFlag::RepliedMessage, "Replying to", MessageElementFlag::RepliedMessage,
MessageColor::System, FontStyle::ChatMediumSmall); MessageColor::System, FontStyle::ChatMediumSmall);
this->emplace<TextElement>( if (this->isIgnoredReply())
"@" + name + ":", MessageElementFlag::RepliedMessage, {
this->textColor_, FontStyle::ChatMediumSmall) body = QString("[Blocked user]");
->setLink({Link::UserInfo, name}); }
else
{
auto name = replyDisplayName->toString();
body = parseTagString(replyBody->toString());
this->emplace<TextElement>(
"@" + name + ":", MessageElementFlag::RepliedMessage,
this->textColor_, FontStyle::ChatMediumSmall)
->setLink({Link::UserInfo, name});
}
this->emplace<SingleLineTextElement>( this->emplace<SingleLineTextElement>(
body, body,
@@ -53,6 +53,7 @@ public:
TwitchChannel *twitchChannel; TwitchChannel *twitchChannel;
[[nodiscard]] bool isIgnored() const override; [[nodiscard]] bool isIgnored() const override;
bool isIgnoredReply() const;
void triggerHighlights() override; void triggerHighlights() override;
MessagePtr build() override; MessagePtr build() override;