From e8fd49aadbf4600b11c33828d254f85c191d4420 Mon Sep 17 00:00:00 2001 From: xel86 Date: Sun, 16 Oct 2022 06:28:22 -0400 Subject: [PATCH] Fix channel-based popups rewriting messages to file log (#4060) Co-authored-by: pajlada --- CHANGELOG.md | 1 + src/widgets/dialogs/ReplyThreadPopup.cpp | 17 ++++++++++++++--- src/widgets/dialogs/UserInfoPopup.cpp | 6 +++++- src/widgets/helper/SearchPopup.cpp | 7 ++++++- 4 files changed, 26 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 30b6908e2..b62c42912 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -93,6 +93,7 @@ - Bugfix: Fixed non-global FrankerFaceZ emotes from being loaded as global emotes. (#3921) - Bugfix: Fixed trailing spaces from preventing Nicknames from working correctly. (#3946) - Bugfix: Fixed trailing spaces from preventing User Highlights from working correctly. (#4051) +- Bugfix: Fixed channel-based popups from rewriting messages to file log (#4060) - Dev: Removed official support for QMake. (#3839, #3883) - Dev: Rewrote LimitedQueue (#3798) - Dev: Overhauled highlight system by moving all checks into a Controller allowing for easier tests. (#3399, #3801, #3835) diff --git a/src/widgets/dialogs/ReplyThreadPopup.cpp b/src/widgets/dialogs/ReplyThreadPopup.cpp index c4771de03..6fc387dfa 100644 --- a/src/widgets/dialogs/ReplyThreadPopup.cpp +++ b/src/widgets/dialogs/ReplyThreadPopup.cpp @@ -130,12 +130,19 @@ void ReplyThreadPopup::addMessagesFromThread() this->ui_.threadView->setChannel(virtualChannel); this->ui_.threadView->setSourceChannel(sourceChannel); - virtualChannel->addMessage(this->thread_->root()); + auto overrideFlags = + boost::optional(this->thread_->root()->flags); + overrideFlags->set(MessageFlag::DoNotLog); + + virtualChannel->addMessage(this->thread_->root(), overrideFlags); for (const auto &msgRef : this->thread_->replies()) { if (auto msg = msgRef.lock()) { - virtualChannel->addMessage(msg); + auto overrideFlags = boost::optional(msg->flags); + overrideFlags->set(MessageFlag::DoNotLog); + + virtualChannel->addMessage(msg, overrideFlags); } } @@ -145,8 +152,12 @@ void ReplyThreadPopup::addMessagesFromThread() [this, virtualChannel](MessagePtr &message, auto) { if (message->replyThread == this->thread_) { + auto overrideFlags = + boost::optional(message->flags); + overrideFlags->set(MessageFlag::DoNotLog); + // same reply thread, add message - virtualChannel->addMessage(message); + virtualChannel->addMessage(message, overrideFlags); } })); } diff --git a/src/widgets/dialogs/UserInfoPopup.cpp b/src/widgets/dialogs/UserInfoPopup.cpp index a57fcedc5..2781672e9 100644 --- a/src/widgets/dialogs/UserInfoPopup.cpp +++ b/src/widgets/dialogs/UserInfoPopup.cpp @@ -105,9 +105,13 @@ namespace { for (size_t i = 0; i < snapshot.size(); i++) { MessagePtr message = snapshot[i]; + + auto overrideFlags = boost::optional(message->flags); + overrideFlags->set(MessageFlag::DoNotLog); + if (checkMessageUserName(userName, message)) { - channelPtr->addMessage(message); + channelPtr->addMessage(message, overrideFlags); } } diff --git a/src/widgets/helper/SearchPopup.cpp b/src/widgets/helper/SearchPopup.cpp index f09186165..8c4f24719 100644 --- a/src/widgets/helper/SearchPopup.cpp +++ b/src/widgets/helper/SearchPopup.cpp @@ -46,7 +46,12 @@ ChannelPtr SearchPopup::filter(const QString &text, const QString &channelName, // If all predicates match, add the message to the channel if (accept) - channel->addMessage(message); + { + auto overrideFlags = boost::optional(message->flags); + overrideFlags->set(MessageFlag::DoNotLog); + + channel->addMessage(message, overrideFlags); + } } return channel;