Deprecated /(un)follow commands and respective usercard action (#3078)
/(un)follow commands are marked as deprecated and link to the issue this PR is closing. follow button on the usercard is removed completely Co-authored-by: pajlada <rasmus.karlsson@pajlada.com> Co-authored-by: Felanbird <41973452+Felanbird@users.noreply.github.com>
This commit is contained in:
@@ -233,7 +233,6 @@ UserInfoPopup::UserInfoPopup(bool closeAutomatically, QWidget *parent)
|
||||
{
|
||||
user->addStretch(1);
|
||||
|
||||
user.emplace<QCheckBox>("Follow").assign(&this->ui_.follow);
|
||||
user.emplace<QCheckBox>("Block").assign(&this->ui_.block);
|
||||
user.emplace<QCheckBox>("Ignore highlights")
|
||||
.assign(&this->ui_.ignoreHighlights);
|
||||
@@ -403,56 +402,6 @@ void UserInfoPopup::scaleChangedEvent(float /*scale*/)
|
||||
|
||||
void UserInfoPopup::installEvents()
|
||||
{
|
||||
std::weak_ptr<bool> hack = this->hack_;
|
||||
|
||||
// follow
|
||||
QObject::connect(
|
||||
this->ui_.follow, &QCheckBox::stateChanged,
|
||||
[this](int newState) mutable {
|
||||
auto currentUser = getApp()->accounts->twitch.getCurrent();
|
||||
|
||||
const auto reenableFollowCheckbox = [this] {
|
||||
this->ui_.follow->setEnabled(true);
|
||||
};
|
||||
|
||||
if (!this->ui_.follow->isEnabled())
|
||||
{
|
||||
// We received a state update while the checkbox was disabled
|
||||
// This can only happen from the "check current follow state" call
|
||||
// The state has been updated to properly reflect the users current follow state
|
||||
reenableFollowCheckbox();
|
||||
return;
|
||||
}
|
||||
|
||||
switch (newState)
|
||||
{
|
||||
case Qt::CheckState::Unchecked: {
|
||||
this->ui_.follow->setEnabled(false);
|
||||
getHelix()->unfollowUser(currentUser->getUserId(),
|
||||
this->userId_,
|
||||
reenableFollowCheckbox, [] {
|
||||
//
|
||||
});
|
||||
}
|
||||
break;
|
||||
|
||||
case Qt::CheckState::PartiallyChecked: {
|
||||
// We deliberately ignore this state
|
||||
}
|
||||
break;
|
||||
|
||||
case Qt::CheckState::Checked: {
|
||||
this->ui_.follow->setEnabled(false);
|
||||
getHelix()->followUser(currentUser->getUserId(),
|
||||
this->userId_,
|
||||
reenableFollowCheckbox, [] {
|
||||
//
|
||||
});
|
||||
}
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
std::shared_ptr<bool> ignoreNext = std::make_shared<bool>(false);
|
||||
|
||||
// block
|
||||
@@ -616,8 +565,6 @@ void UserInfoPopup::updateLatestMessages()
|
||||
|
||||
void UserInfoPopup::updateUserData()
|
||||
{
|
||||
this->ui_.follow->setEnabled(false);
|
||||
|
||||
std::weak_ptr<bool> hack = this->hack_;
|
||||
auto currentUser = getApp()->accounts->twitch.getCurrent();
|
||||
|
||||
@@ -683,19 +630,6 @@ void UserInfoPopup::updateUserData()
|
||||
// on failure
|
||||
});
|
||||
|
||||
// get follow state
|
||||
currentUser->checkFollow(user.id, [this, hack](auto result) {
|
||||
if (!hack.lock())
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (result != FollowResult_Failed)
|
||||
{
|
||||
this->ui_.follow->setChecked(result == FollowResult_Following);
|
||||
this->ui_.follow->setEnabled(true);
|
||||
}
|
||||
});
|
||||
|
||||
// get ignore state
|
||||
bool isIgnoring = false;
|
||||
|
||||
@@ -772,7 +706,6 @@ void UserInfoPopup::updateUserData()
|
||||
getHelix()->getUserByName(this->userName_, onUserFetched,
|
||||
onUserFetchFailed);
|
||||
|
||||
this->ui_.follow->setEnabled(false);
|
||||
this->ui_.block->setEnabled(false);
|
||||
this->ui_.ignoreHighlights->setEnabled(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user