Fix channel-based popups rewriting messages to file log (#4060)

Co-authored-by: pajlada <rasmus.karlsson@pajlada.com>
This commit is contained in:
xel86 2022-10-16 06:28:22 -04:00 committed by GitHub
parent 4152f0dccb
commit e8fd49aadb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 26 additions and 5 deletions

View file

@ -93,6 +93,7 @@
- Bugfix: Fixed non-global FrankerFaceZ emotes from being loaded as global emotes. (#3921) - 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 Nicknames from working correctly. (#3946)
- Bugfix: Fixed trailing spaces from preventing User Highlights from working correctly. (#4051) - 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: Removed official support for QMake. (#3839, #3883)
- Dev: Rewrote LimitedQueue (#3798) - Dev: Rewrote LimitedQueue (#3798)
- Dev: Overhauled highlight system by moving all checks into a Controller allowing for easier tests. (#3399, #3801, #3835) - Dev: Overhauled highlight system by moving all checks into a Controller allowing for easier tests. (#3399, #3801, #3835)

View file

@ -130,12 +130,19 @@ void ReplyThreadPopup::addMessagesFromThread()
this->ui_.threadView->setChannel(virtualChannel); this->ui_.threadView->setChannel(virtualChannel);
this->ui_.threadView->setSourceChannel(sourceChannel); this->ui_.threadView->setSourceChannel(sourceChannel);
virtualChannel->addMessage(this->thread_->root()); auto overrideFlags =
boost::optional<MessageFlags>(this->thread_->root()->flags);
overrideFlags->set(MessageFlag::DoNotLog);
virtualChannel->addMessage(this->thread_->root(), overrideFlags);
for (const auto &msgRef : this->thread_->replies()) for (const auto &msgRef : this->thread_->replies())
{ {
if (auto msg = msgRef.lock()) if (auto msg = msgRef.lock())
{ {
virtualChannel->addMessage(msg); auto overrideFlags = boost::optional<MessageFlags>(msg->flags);
overrideFlags->set(MessageFlag::DoNotLog);
virtualChannel->addMessage(msg, overrideFlags);
} }
} }
@ -145,8 +152,12 @@ void ReplyThreadPopup::addMessagesFromThread()
[this, virtualChannel](MessagePtr &message, auto) { [this, virtualChannel](MessagePtr &message, auto) {
if (message->replyThread == this->thread_) if (message->replyThread == this->thread_)
{ {
auto overrideFlags =
boost::optional<MessageFlags>(message->flags);
overrideFlags->set(MessageFlag::DoNotLog);
// same reply thread, add message // same reply thread, add message
virtualChannel->addMessage(message); virtualChannel->addMessage(message, overrideFlags);
} }
})); }));
} }

View file

@ -105,9 +105,13 @@ namespace {
for (size_t i = 0; i < snapshot.size(); i++) for (size_t i = 0; i < snapshot.size(); i++)
{ {
MessagePtr message = snapshot[i]; MessagePtr message = snapshot[i];
auto overrideFlags = boost::optional<MessageFlags>(message->flags);
overrideFlags->set(MessageFlag::DoNotLog);
if (checkMessageUserName(userName, message)) if (checkMessageUserName(userName, message))
{ {
channelPtr->addMessage(message); channelPtr->addMessage(message, overrideFlags);
} }
} }

View file

@ -46,7 +46,12 @@ ChannelPtr SearchPopup::filter(const QString &text, const QString &channelName,
// If all predicates match, add the message to the channel // If all predicates match, add the message to the channel
if (accept) if (accept)
channel->addMessage(message); {
auto overrideFlags = boost::optional<MessageFlags>(message->flags);
overrideFlags->set(MessageFlag::DoNotLog);
channel->addMessage(message, overrideFlags);
}
} }
return channel; return channel;