From 96feff6e5ca9436d18f8e68cb00b877f2ce7d534 Mon Sep 17 00:00:00 2001 From: Kyle Scarmack Date: Sun, 16 Feb 2025 14:07:34 -0500 Subject: [PATCH] fix: opening a usercard from `/live` no longer makes failing ivr API call (#5959) Fixes #5878 --- CHANGELOG.md | 1 + src/widgets/dialogs/UserInfoPopup.cpp | 78 ++++++++++++++------------- 2 files changed, 43 insertions(+), 36 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 36d2f232..56858cc9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ - Bugfix: Fixed announcements not showing up in mentions tab. (#5857) - Bugfix: Fixed the reply button showing for inline whispers and announcements. (#5863) - Bugfix: Fixed suspicious user treatment update messages not being searchable. (#5865) +- Bugfix: Fixed user info popup's opened from `/live` making some network requests that always failed. (#5959) - Bugfix: Ensure miniaudio backend exits even if it doesn't exit cleanly. (#5896) - Bugfix: Fixed search in emote popup not always working correctly. (#5946) - Bugfix: Fixed channel point redemptions with messages not showing up if PubSub is disconnected. (#5948) diff --git a/src/widgets/dialogs/UserInfoPopup.cpp b/src/widgets/dialogs/UserInfoPopup.cpp index 45ad054e..7635021b 100644 --- a/src/widgets/dialogs/UserInfoPopup.cpp +++ b/src/widgets/dialogs/UserInfoPopup.cpp @@ -945,44 +945,50 @@ void UserInfoPopup::updateUserData() this->ui_.block->setEnabled(true); this->ui_.ignoreHighlights->setChecked(isIgnoringHighlights); - // get followage and subage - getIvr()->getSubage( - this->userName_, this->underlyingChannel_->getName(), - [this, hack](const IvrSubage &subageInfo) { - if (!hack.lock()) - { - return; - } + auto type = this->underlyingChannel_->getType(); - if (!subageInfo.followingSince.isEmpty()) - { - QDateTime followedAt = QDateTime::fromString( - subageInfo.followingSince, Qt::ISODate); - QString followingSince = followedAt.toString("yyyy-MM-dd"); - this->ui_.followageLabel->setText("❤ Following since " + - followingSince); - } + if (type == Channel::Type::Twitch) + { + // get followage and subage + getIvr()->getSubage( + this->userName_, this->underlyingChannel_->getName(), + [this, hack](const IvrSubage &subageInfo) { + if (!hack.lock()) + { + return; + } - if (subageInfo.isSubHidden) - { - this->ui_.subageLabel->setText( - "Subscription status hidden"); - } - else if (subageInfo.isSubbed) - { - this->ui_.subageLabel->setText( - QString("★ Tier %1 - Subscribed for %2 months") - .arg(subageInfo.subTier) - .arg(subageInfo.totalSubMonths)); - } - else if (subageInfo.totalSubMonths) - { - this->ui_.subageLabel->setText( - QString("★ Previously subscribed for %1 months") - .arg(subageInfo.totalSubMonths)); - } - }, - [] {}); + if (!subageInfo.followingSince.isEmpty()) + { + QDateTime followedAt = QDateTime::fromString( + subageInfo.followingSince, Qt::ISODate); + QString followingSince = + followedAt.toString("yyyy-MM-dd"); + this->ui_.followageLabel->setText("❤ Following since " + + followingSince); + } + + if (subageInfo.isSubHidden) + { + this->ui_.subageLabel->setText( + "Subscription status hidden"); + } + else if (subageInfo.isSubbed) + { + this->ui_.subageLabel->setText( + QString("★ Tier %1 - Subscribed for %2 months") + .arg(subageInfo.subTier) + .arg(subageInfo.totalSubMonths)); + } + else if (subageInfo.totalSubMonths) + { + this->ui_.subageLabel->setText( + QString("★ Previously subscribed for %1 months") + .arg(subageInfo.totalSubMonths)); + } + }, + [] {}); + } // get pronouns if (getSettings()->showPronouns)