Delete 'is live' messages from non-open channels (#3678)

Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit is contained in:
Mm2PL 2022-04-30 11:37:24 +00:00 committed by GitHub
parent d85d9d4910
commit 00b463d298
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 0 deletions

View file

@ -10,6 +10,7 @@
- Minor: Added chatter count for each category in viewer list. (#3683) - Minor: Added chatter count for each category in viewer list. (#3683)
- Minor: Added option to open a user's chat in a new tab from the usercard profile picture context menu. (#3625) - Minor: Added option to open a user's chat in a new tab from the usercard profile picture context menu. (#3625)
- Bugfix: Fixed live notifications for usernames containing uppercase characters. (#3646) - Bugfix: Fixed live notifications for usernames containing uppercase characters. (#3646)
- Bugfix: Fixed live notifications not getting updated for closed streams going offline. (#3678)
- Bugfix: Fixed certain settings dialogs appearing behind the main window, when `Always on top` was used. (#3679) - Bugfix: Fixed certain settings dialogs appearing behind the main window, when `Always on top` was used. (#3679)
- Bugfix: Fixed an issue in the emote picker where an emotes tooltip would not properly disappear. (#3686) - Bugfix: Fixed an issue in the emote picker where an emotes tooltip would not properly disappear. (#3686)
- Bugfix: Fixed incorrect spacing of settings icons at high DPI. (#3698) - Bugfix: Fixed incorrect spacing of settings icons at high DPI. (#3698)

View file

@ -249,6 +249,26 @@ void NotificationController::removeFakeChannel(const QString channelName)
if (i != fakeTwitchChannels.end()) if (i != fakeTwitchChannels.end())
{ {
fakeTwitchChannels.erase(i); fakeTwitchChannels.erase(i);
// "delete" old 'CHANNEL is live' message
LimitedQueueSnapshot<MessagePtr> snapshot =
getApp()->twitch->liveChannel->getMessageSnapshot();
int snapshotLength = snapshot.size();
// MSVC hates this code if the parens are not there
int end = (std::max)(0, snapshotLength - 200);
// this assumes that channelName is a login name therefore will only delete messages from fake channels
auto liveMessageSearchText = QString("%1 is live!").arg(channelName);
for (int i = snapshotLength - 1; i >= end; --i)
{
auto &s = snapshot[i];
if (s->messageText == liveMessageSearchText)
{
s->flags.set(MessageFlag::Disabled);
break;
}
}
} }
} }