feat: add setting to hide blocked term automod messages (#5690)
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
#include "providers/twitch/api/Helix.hpp"
|
||||
#include "providers/twitch/ChannelPointReward.hpp"
|
||||
#include "providers/twitch/PubSubActions.hpp"
|
||||
#include "providers/twitch/pubsubmessages/AutoMod.hpp"
|
||||
#include "providers/twitch/TwitchAccount.hpp"
|
||||
#include "providers/twitch/TwitchBadge.hpp"
|
||||
#include "providers/twitch/TwitchBadges.hpp"
|
||||
@@ -1637,6 +1638,12 @@ std::pair<MessagePtr, MessagePtr> MessageBuilder::makeAutomodMessage(
|
||||
{
|
||||
MessageBuilder builder, builder2;
|
||||
|
||||
if (action.reasonCode == PubSubAutoModQueueMessage::Reason::BlockedTerm)
|
||||
{
|
||||
builder.message().flags.set(MessageFlag::AutoModBlockedTerm);
|
||||
builder2.message().flags.set(MessageFlag::AutoModBlockedTerm);
|
||||
}
|
||||
|
||||
//
|
||||
// Builder for AutoMod message with explanation
|
||||
builder.message().id = "automod_" + action.msgID;
|
||||
|
||||
@@ -52,6 +52,8 @@ enum class MessageFlag : std::int64_t {
|
||||
Action = (1LL << 36),
|
||||
/// The message is sent in a different source channel as part of a Shared Chat session
|
||||
SharedMessage = (1LL << 37),
|
||||
/// AutoMod message that showed up due to containing a blocked term in the channel
|
||||
AutoModBlockedTerm = (1LL << 38),
|
||||
};
|
||||
using MessageFlags = FlagsEnum<MessageFlag>;
|
||||
|
||||
|
||||
@@ -141,6 +141,9 @@ void MessageLayout::actuallyLayout(const MessageLayoutContext &ctx)
|
||||
|
||||
bool hideModerated = getSettings()->hideModerated;
|
||||
bool hideModerationActions = getSettings()->hideModerationActions;
|
||||
bool hideBlockedTermAutomodMessages =
|
||||
getSettings()->showBlockedTermAutomodMessages.getEnum() ==
|
||||
ShowModerationState::Never;
|
||||
bool hideSimilar = getSettings()->hideSimilar;
|
||||
bool hideReplies = !ctx.flags.has(MessageElementFlag::RepliedMessage);
|
||||
|
||||
@@ -154,9 +157,21 @@ void MessageLayout::actuallyLayout(const MessageLayoutContext &ctx)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (hideBlockedTermAutomodMessages &&
|
||||
this->message_->flags.has(MessageFlag::AutoModBlockedTerm))
|
||||
{
|
||||
// NOTE: This hides the message but it will make the message re-appear if moderation message hiding is no longer active, and the layout is re-laid-out.
|
||||
// This is only the case for the moderation messages that don't get filtered during creation.
|
||||
// We should decide which is the correct method & apply that everywhere
|
||||
continue;
|
||||
}
|
||||
|
||||
if (this->message_->flags.has(MessageFlag::Timeout) ||
|
||||
this->message_->flags.has(MessageFlag::Untimeout))
|
||||
{
|
||||
// NOTE: This hides the message but it will make the message re-appear if moderation message hiding is no longer active, and the layout is re-laid-out.
|
||||
// This is only the case for the moderation messages that don't get filtered during creation.
|
||||
// We should decide which is the correct method & apply that everywhere
|
||||
if (hideModerationActions ||
|
||||
(getSettings()->streamerModeHideModActions &&
|
||||
getApp()->getStreamerMode()->isEnabled()))
|
||||
|
||||
Reference in New Issue
Block a user