From e7c409d9f01b4e5033f549c0a6eb7066ea8f9fb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Forr=C3=B3?= Date: Wed, 27 Jun 2018 12:27:15 +0200 Subject: [PATCH] Do not fetch recent messages and viewer list for chatrooms --- src/providers/twitch/TwitchChannel.cpp | 5 ++++- src/widgets/splits/Split.cpp | 26 +++++++++++++++----------- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/src/providers/twitch/TwitchChannel.cpp b/src/providers/twitch/TwitchChannel.cpp index 77a245849..d8133b2b8 100644 --- a/src/providers/twitch/TwitchChannel.cpp +++ b/src/providers/twitch/TwitchChannel.cpp @@ -123,7 +123,10 @@ void TwitchChannel::setRoomID(const QString &_roomID) { this->roomID = _roomID; this->roomIDchanged.invoke(); - this->fetchMessages.invoke(); + + if (!this->name.startsWith("chatrooms:")) { + this->fetchMessages.invoke(); + } } void TwitchChannel::reloadChannelEmotes() diff --git a/src/widgets/splits/Split.cpp b/src/widgets/splits/Split.cpp index 87db97eb5..2a22e22d1 100644 --- a/src/widgets/splits/Split.cpp +++ b/src/widgets/splits/Split.cpp @@ -449,18 +449,22 @@ void Split::doOpenViewerList() } auto loadingLabel = new QLabel("Loading..."); - twitchApiGet("https://tmi.twitch.tv/group/user/" + this->getChannel()->name + "/chatters", this, - [=](QJsonObject obj) { - QJsonObject chattersObj = obj.value("chatters").toObject(); + if (!this->getChannel()->name.startsWith("chatrooms:")) { + twitchApiGet("https://tmi.twitch.tv/group/user/" + this->getChannel()->name + "/chatters", this, + [=](QJsonObject obj) { + QJsonObject chattersObj = obj.value("chatters").toObject(); - loadingLabel->hide(); - for (int i = 0; i < jsonLabels.size(); i++) { - chattersList->addItem(labelList.at(i)); - foreach (const QJsonValue &v, - chattersObj.value(jsonLabels.at(i)).toArray()) - chattersList->addItem(v.toString()); - } - }); + loadingLabel->hide(); + for (int i = 0; i < jsonLabels.size(); i++) { + chattersList->addItem(labelList.at(i)); + foreach (const QJsonValue &v, + chattersObj.value(jsonLabels.at(i)).toArray()) + chattersList->addItem(v.toString()); + } + }); + } else { + loadingLabel->hide(); + } searchBar->setPlaceholderText("Search User..."); QObject::connect(searchBar, &QLineEdit::textEdited, this, [=]() {