fix: don't show moderation buttons on your own usercard (#6107)

Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit is contained in:
Jujufrost
2025-03-23 08:42:28 -04:00
committed by GitHub
parent 95a9115d82
commit 46efb7a25c
2 changed files with 20 additions and 4 deletions
+1
View File
@@ -7,6 +7,7 @@
- Bugfix: Fixed the channel name input not being focused when opening the select-channel dialog. (#6096)
- Bugfix: Fixed inputs in dialogs not having a border around and padding in them. (#6098)
- Bugfix: Don't set default binding for "Toggle local R9K" on macOS. Was <kbd>CTRL</kbd> + <kdb>H</kdb> before, which clashes with a system binding. (#5764)
- Bugfix: Don't add moderation buttons to your own Usercard. (#6107)
- Dev: Temporarily disable precompiled header support for macOS. (#6104)
## 2.5.3-beta.1
+19 -4
View File
@@ -499,10 +499,20 @@ UserInfoPopup::UserInfoPopup(bool closeAutomatically, Split *split)
TwitchChannel *twitchChannel = dynamic_cast<TwitchChannel *>(
this->underlyingChannel_.get());
bool hasModRights =
twitchChannel ? twitchChannel->hasModRights() : false;
lineMod->setVisible(hasModRights);
timeout->setVisible(hasModRights);
bool visible = false;
if (twitchChannel)
{
bool isMyself =
getApp()
->getAccounts()
->twitch.getCurrent()
->getUserName()
.compare(this->userName_, Qt::CaseInsensitive) == 0;
bool hasModRights = twitchChannel->hasModRights();
visible = hasModRights && !isMyself;
}
lineMod->setVisible(visible);
timeout->setVisible(visible);
});
// We can safely ignore this signal connection since we own the button, and
@@ -1041,6 +1051,11 @@ void UserInfoPopup::updateUserData()
this->ui_.block->setEnabled(false);
this->ui_.ignoreHighlights->setEnabled(false);
bool isMyself =
getApp()->getAccounts()->twitch.getCurrent()->getUserName().compare(
this->userName_, Qt::CaseInsensitive) == 0;
this->ui_.block->setVisible(!isMyself);
this->ui_.ignoreHighlights->setVisible(!isMyself);
}
void UserInfoPopup::loadAvatar(const QUrl &url)