Do not fetch recent messages and viewer list for chatrooms

This commit is contained in:
Nikola Forró 2018-06-27 12:27:15 +02:00
parent e9868fdd84
commit e7c409d9f0
2 changed files with 19 additions and 12 deletions

View file

@ -123,7 +123,10 @@ void TwitchChannel::setRoomID(const QString &_roomID)
{ {
this->roomID = _roomID; this->roomID = _roomID;
this->roomIDchanged.invoke(); this->roomIDchanged.invoke();
this->fetchMessages.invoke();
if (!this->name.startsWith("chatrooms:")) {
this->fetchMessages.invoke();
}
} }
void TwitchChannel::reloadChannelEmotes() void TwitchChannel::reloadChannelEmotes()

View file

@ -449,18 +449,22 @@ void Split::doOpenViewerList()
} }
auto loadingLabel = new QLabel("Loading..."); auto loadingLabel = new QLabel("Loading...");
twitchApiGet("https://tmi.twitch.tv/group/user/" + this->getChannel()->name + "/chatters", this, if (!this->getChannel()->name.startsWith("chatrooms:")) {
[=](QJsonObject obj) { twitchApiGet("https://tmi.twitch.tv/group/user/" + this->getChannel()->name + "/chatters", this,
QJsonObject chattersObj = obj.value("chatters").toObject(); [=](QJsonObject obj) {
QJsonObject chattersObj = obj.value("chatters").toObject();
loadingLabel->hide(); loadingLabel->hide();
for (int i = 0; i < jsonLabels.size(); i++) { for (int i = 0; i < jsonLabels.size(); i++) {
chattersList->addItem(labelList.at(i)); chattersList->addItem(labelList.at(i));
foreach (const QJsonValue &v, foreach (const QJsonValue &v,
chattersObj.value(jsonLabels.at(i)).toArray()) chattersObj.value(jsonLabels.at(i)).toArray())
chattersList->addItem(v.toString()); chattersList->addItem(v.toString());
} }
}); });
} else {
loadingLabel->hide();
}
searchBar->setPlaceholderText("Search User..."); searchBar->setPlaceholderText("Search User...");
QObject::connect(searchBar, &QLineEdit::textEdited, this, [=]() { QObject::connect(searchBar, &QLineEdit::textEdited, this, [=]() {