-
Some people don't like reply threads or how they're displayed in Chatterino and want to "hide replies" - hide the reply context. My thinking was to add a setting that hides the reply context in the rendered messages, so these messages look like regular messages. I don't think adding a setting that completely ignores replies is good, as it will overcomplicate a lot of the code. Suggested Diffdiff --git a/src/providers/twitch/IrcMessageHandler.cpp b/src/providers/twitch/IrcMessageHandler.cpp
index 922b8cf4..0e8ea2ca 100644
--- a/src/providers/twitch/IrcMessageHandler.cpp
+++ b/src/providers/twitch/IrcMessageHandler.cpp
@@ -70,7 +70,7 @@ MessagePtr generateBannedMessage(bool confirmedBan)
int stripLeadingReplyMention(const QVariantMap &tags, QString &content)
{
- if (!getSettings()->stripReplyMention)
+ if (!getSettings()->stripReplyMention || !getSettings()->showReplyContext)
{
return 0;
}
diff --git a/src/providers/twitch/TwitchMessageBuilder.cpp b/src/providers/twitch/TwitchMessageBuilder.cpp
index b6d627d8..2e3417dc 100644
--- a/src/providers/twitch/TwitchMessageBuilder.cpp
+++ b/src/providers/twitch/TwitchMessageBuilder.cpp
@@ -235,32 +235,37 @@ MessagePtr TwitchMessageBuilder::build()
// enable reply flag
this->message().flags.set(MessageFlag::ReplyMessage);
- const auto &threadRoot = this->thread_->root();
+ if (getSettings()->showReplyContext)
+ {
+ const auto &threadRoot = this->thread_->root();
- QString usernameText = SharedMessageBuilder::stylizeUsername(
- threadRoot->loginName, *threadRoot.get());
+ QString usernameText = SharedMessageBuilder::stylizeUsername(
+ threadRoot->loginName, *threadRoot.get());
- this->emplace<ReplyCurveElement>();
+ this->emplace<ReplyCurveElement>();
- // construct reply elements
- this->emplace<TextElement>(
- "Replying to", MessageElementFlag::RepliedMessage,
- MessageColor::System, FontStyle::ChatMediumSmall)
- ->setLink({Link::ViewThread, this->thread_->rootId()});
+ // construct reply elements
+ this->emplace<TextElement>(
+ "Replying to", MessageElementFlag::RepliedMessage,
+ MessageColor::System, FontStyle::ChatMediumSmall)
+ ->setLink({Link::ViewThread, this->thread_->rootId()});
- this->emplace<TextElement>(
- "@" + usernameText + ":", MessageElementFlag::RepliedMessage,
- threadRoot->usernameColor, FontStyle::ChatMediumSmall)
- ->setLink({Link::UserInfo, threadRoot->displayName});
+ this->emplace<TextElement>("@" + usernameText + ":",
+ MessageElementFlag::RepliedMessage,
+ threadRoot->usernameColor,
+ FontStyle::ChatMediumSmall)
+ ->setLink({Link::UserInfo, threadRoot->displayName});
- this->emplace<SingleLineTextElement>(
- threadRoot->messageText,
- MessageElementFlags({MessageElementFlag::RepliedMessage,
- MessageElementFlag::Text}),
- this->textColor_, FontStyle::ChatMediumSmall)
- ->setLink({Link::ViewThread, this->thread_->rootId()});
+ this->emplace<SingleLineTextElement>(
+ threadRoot->messageText,
+ MessageElementFlags({MessageElementFlag::RepliedMessage,
+ MessageElementFlag::Text}),
+ this->textColor_, FontStyle::ChatMediumSmall)
+ ->setLink({Link::ViewThread, this->thread_->rootId()});
+ }
}
- else if (this->tags.find("reply-parent-msg-id") != this->tags.end())
+ else if (this->tags.find("reply-parent-msg-id") != this->tags.end() &&
+ getSettings()->showReplyContext)
{
// Message is a reply but we couldn't find the original message.
// Render the message using the additional reply tags
diff --git a/src/singletons/Settings.hpp b/src/singletons/Settings.hpp
index b6148930..74199cf7 100644
--- a/src/singletons/Settings.hpp
+++ b/src/singletons/Settings.hpp
@@ -119,6 +119,7 @@ public:
// BoolSetting collapseLongMessages =
// {"/appearance/messages/collapseLongMessages", false};
+ BoolSetting showReplyContext = {"/appearance/showReplyContext", true};
BoolSetting showReplyButton = {"/appearance/showReplyButton", false};
BoolSetting stripReplyMention = {"/appearance/stripReplyMention", true};
IntSetting collpseMessagesMinLines = {
diff --git a/src/widgets/settingspages/GeneralPage.cpp b/src/widgets/settingspages/GeneralPage.cpp
index 24d189c3..1f0f441b 100644
--- a/src/widgets/settingspages/GeneralPage.cpp
+++ b/src/widgets/settingspages/GeneralPage.cpp
@@ -190,6 +190,10 @@ void GeneralPage::initLayout(GeneralPageView &layout)
tabDirectionDropdown->setMinimumWidth(
tabDirectionDropdown->minimumSizeHint().width());
+ layout.addCheckbox(
+ "Show message reply context", s.showReplyContext, false,
+ "This setting will only affect how messages are rendered. You can "
+ "reply to a message regardless of this setting.");
layout.addCheckbox("Show message reply button", s.showReplyButton);
layout.addCheckbox("Show tab close button", s.showTabCloseButton);
layout.addCheckbox("Always on top", s.windowTopMost, false,
@@ -843,10 +847,11 @@ void GeneralPage::initLayout(GeneralPageView &layout)
"message) into one cheermote.");
layout.addCheckbox("Messages in /mentions highlights tab",
s.highlightMentions);
- layout.addCheckbox("Strip leading mention in replies", s.stripReplyMention,
- true,
- "When disabled, messages sent in reply threads will "
- "include the @mention for the related thread");
+ layout.addCheckbox(
+ "Strip leading mention in replies", s.stripReplyMention, true,
+ "When disabled, messages sent in reply threads will "
+ "include the @mention for the related thread. If the rendering of the"
+ "reply context is turned off, these mentions will never be stripped.");
// Helix timegate settings
auto helixTimegateGetValue = [](auto val) { |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
Given how small of a change this is, I'm fine with it I will have messed up your diff with #4222 but after this PR you should be able to make the diff much smaller since you can just return if the setting is disabled |
Beta Was this translation helpful? Give feedback.
-
I'd actually recommend implementing the hiding of the reply context as such: diff --git a/src/widgets/helper/ChannelView.cpp b/src/widgets/helper/ChannelView.cpp
index a7dddfac..ff3c7b6a 100644
--- a/src/widgets/helper/ChannelView.cpp
+++ b/src/widgets/helper/ChannelView.cpp
@@ -1124,7 +1124,8 @@ MessageElementFlags ChannelView::getFlags() const
if (this->sourceChannel_ == app->twitch->mentionsChannel)
flags.set(MessageElementFlag::ChannelName);
- if (this->context_ == Context::ReplyThread)
+ if (this->context_ == Context::ReplyThread ||
+ !getSettings()->showReplyContext)
{
// Don't show inline replies within the ReplyThreadPopup
flags.unset(MessageElementFlag::RepliedMessage); We already have logic to hide the reply context, so we might as well reuse it. It also means that the setting will take effect for already-built messages. |
Beta Was this translation helpful? Give feedback.
-
Implemented in #4224 |
Beta Was this translation helpful? Give feedback.
Implemented in #4224