fix: lead moderator role detection (#6642)
Reviewed-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
- Minor: Added broadcaster-only `/poll`, `/cancelpoll`, and `/endpoll` commands. (#6583, #6605)
|
||||
- Minor: Added broadcaster-only `/prediction`, `/cancelprediction`, and `/lockprediction` commands. (#6583, #6612)
|
||||
- Minor: Added support for BetterTTV Pro subscriber badges. (#6625)
|
||||
- Bugfix: Moderation checks now include the lead moderator badge. (#6642)
|
||||
- Bugfix: Expose the "Extra extension IDs" setting on non-Windows systems too. (#6509)
|
||||
- Bugfix: Fixed some commands and filters not working as expected in seach popups. (#6539)
|
||||
- Bugfix: Fixed settings occasionally not opening when clicking on "Manage Accounts" in the account switcher. (#6543)
|
||||
|
||||
@@ -394,7 +394,8 @@ void IrcMessageHandler::parsePrivMessageInto(
|
||||
if (badgesTag.isValid())
|
||||
{
|
||||
auto parsedBadges = parseBadges(badgesTag.toString());
|
||||
channel->setMod(parsedBadges.contains("moderator"));
|
||||
channel->setMod(parsedBadges.contains("moderator") ||
|
||||
parsedBadges.contains("lead_moderator"));
|
||||
channel->setVIP(parsedBadges.contains("vip"));
|
||||
channel->setStaff(parsedBadges.contains("staff"));
|
||||
}
|
||||
@@ -582,27 +583,35 @@ void IrcMessageHandler::handleUserStateMessage(Communi::IrcMessage *message)
|
||||
return;
|
||||
}
|
||||
|
||||
// Checking if currentUser is a VIP or staff member
|
||||
QVariant badgesTag = message->tag("badges");
|
||||
if (badgesTag.isValid())
|
||||
auto *tc = dynamic_cast<TwitchChannel *>(c.get());
|
||||
if (tc != nullptr)
|
||||
{
|
||||
auto *tc = dynamic_cast<TwitchChannel *>(c.get());
|
||||
if (tc != nullptr)
|
||||
bool hasModBadge = false;
|
||||
|
||||
// Checking if currentUser is a VIP, staff member or has moderator badges
|
||||
QVariant badgesTag = message->tag("badges");
|
||||
if (badgesTag.isValid())
|
||||
{
|
||||
auto parsedBadges = parseBadges(badgesTag.toString());
|
||||
tc->setVIP(parsedBadges.contains("vip"));
|
||||
tc->setStaff(parsedBadges.contains("staff"));
|
||||
}
|
||||
}
|
||||
|
||||
// Checking if currentUser is a moderator
|
||||
QVariant modTag = message->tag("mod");
|
||||
if (modTag.isValid())
|
||||
{
|
||||
auto *tc = dynamic_cast<TwitchChannel *>(c.get());
|
||||
if (tc != nullptr)
|
||||
hasModBadge = parsedBadges.contains("moderator") ||
|
||||
parsedBadges.contains("lead_moderator");
|
||||
}
|
||||
|
||||
if (hasModBadge)
|
||||
{
|
||||
tc->setMod(modTag == "1");
|
||||
tc->setMod(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
QVariant modTag = message->tag("mod");
|
||||
if (modTag.isValid())
|
||||
{
|
||||
// Also checking if the mod tag is present, since badges sometimes disappear in IRC
|
||||
tc->setMod(modTag == "1");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ QList<DisplayBadge> availableBadges = {
|
||||
{"Admin", "admin"},
|
||||
{"Staff", "staff"},
|
||||
{"Moderator", "moderator"},
|
||||
{"Lead Moderator", "lead_moderator"},
|
||||
{"Verified", "partner"},
|
||||
{"VIP", "vip"},
|
||||
{"Founder", "founder"},
|
||||
|
||||
Reference in New Issue
Block a user