From 870aa74427fa95091c1e25ec5ea72b953595db4c Mon Sep 17 00:00:00 2001 From: Sidd Date: Wed, 6 Apr 2022 14:10:22 -0700 Subject: [PATCH] Use login name for NotificationController lookup (#3648) Co-authored-by: pajlada --- CHANGELOG.md | 2 ++ src/controllers/notifications/NotificationController.cpp | 4 ++-- src/providers/twitch/api/Helix.hpp | 6 ++++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 73f6596c2..e03311bc1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unversioned +- Bugfix: Fixed live notifications for usernames containing uppercase characters. (#3646) + ## 2.3.5 - Major: Added highlights for first messages (#3267) diff --git a/src/controllers/notifications/NotificationController.cpp b/src/controllers/notifications/NotificationController.cpp index 10dba12ea..2ac4b925d 100644 --- a/src/controllers/notifications/NotificationController.cpp +++ b/src/controllers/notifications/NotificationController.cpp @@ -178,12 +178,12 @@ void NotificationController::fetchFakeChannels() std::unordered_set liveStreams; for (const auto &stream : streams) { - liveStreams.insert(stream.userName); + liveStreams.insert(stream.userLogin); } for (const auto &name : batch) { - auto it = liveStreams.find(name); + auto it = liveStreams.find(name.toLower()); this->checkStream(it != liveStreams.end(), name); } }, diff --git a/src/providers/twitch/api/Helix.hpp b/src/providers/twitch/api/Helix.hpp index 7648243a2..57809c683 100644 --- a/src/providers/twitch/api/Helix.hpp +++ b/src/providers/twitch/api/Helix.hpp @@ -86,8 +86,10 @@ struct HelixUsersFollowsResponse { struct HelixStream { QString id; // stream id QString userId; + QString userLogin; QString userName; QString gameId; + QString gameName; QString type; QString title; int viewerCount; @@ -98,8 +100,10 @@ struct HelixStream { HelixStream() : id("") , userId("") + , userLogin("") , userName("") , gameId("") + , gameName("") , type("") , title("") , viewerCount() @@ -112,8 +116,10 @@ struct HelixStream { explicit HelixStream(QJsonObject jsonObject) : id(jsonObject.value("id").toString()) , userId(jsonObject.value("user_id").toString()) + , userLogin(jsonObject.value("user_login").toString()) , userName(jsonObject.value("user_name").toString()) , gameId(jsonObject.value("game_id").toString()) + , gameName(jsonObject.value("game_name").toString()) , type(jsonObject.value("type").toString()) , title(jsonObject.value("title").toString()) , viewerCount(jsonObject.value("viewer_count").toInt())