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 `/poll`, `/cancelpoll`, and `/endpoll` commands. (#6583, #6605)
|
||||||
- Minor: Added broadcaster-only `/prediction`, `/cancelprediction`, and `/lockprediction` commands. (#6583, #6612)
|
- Minor: Added broadcaster-only `/prediction`, `/cancelprediction`, and `/lockprediction` commands. (#6583, #6612)
|
||||||
- Minor: Added support for BetterTTV Pro subscriber badges. (#6625)
|
- 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: 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 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)
|
- 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())
|
if (badgesTag.isValid())
|
||||||
{
|
{
|
||||||
auto parsedBadges = parseBadges(badgesTag.toString());
|
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->setVIP(parsedBadges.contains("vip"));
|
||||||
channel->setStaff(parsedBadges.contains("staff"));
|
channel->setStaff(parsedBadges.contains("staff"));
|
||||||
}
|
}
|
||||||
@@ -582,27 +583,35 @@ void IrcMessageHandler::handleUserStateMessage(Communi::IrcMessage *message)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Checking if currentUser is a VIP or staff member
|
auto *tc = dynamic_cast<TwitchChannel *>(c.get());
|
||||||
QVariant badgesTag = message->tag("badges");
|
if (tc != nullptr)
|
||||||
if (badgesTag.isValid())
|
|
||||||
{
|
{
|
||||||
auto *tc = dynamic_cast<TwitchChannel *>(c.get());
|
bool hasModBadge = false;
|
||||||
if (tc != nullptr)
|
|
||||||
|
// 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());
|
auto parsedBadges = parseBadges(badgesTag.toString());
|
||||||
tc->setVIP(parsedBadges.contains("vip"));
|
tc->setVIP(parsedBadges.contains("vip"));
|
||||||
tc->setStaff(parsedBadges.contains("staff"));
|
tc->setStaff(parsedBadges.contains("staff"));
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Checking if currentUser is a moderator
|
hasModBadge = parsedBadges.contains("moderator") ||
|
||||||
QVariant modTag = message->tag("mod");
|
parsedBadges.contains("lead_moderator");
|
||||||
if (modTag.isValid())
|
}
|
||||||
{
|
|
||||||
auto *tc = dynamic_cast<TwitchChannel *>(c.get());
|
if (hasModBadge)
|
||||||
if (tc != nullptr)
|
|
||||||
{
|
{
|
||||||
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"},
|
{"Admin", "admin"},
|
||||||
{"Staff", "staff"},
|
{"Staff", "staff"},
|
||||||
{"Moderator", "moderator"},
|
{"Moderator", "moderator"},
|
||||||
|
{"Lead Moderator", "lead_moderator"},
|
||||||
{"Verified", "partner"},
|
{"Verified", "partner"},
|
||||||
{"VIP", "vip"},
|
{"VIP", "vip"},
|
||||||
{"Founder", "founder"},
|
{"Founder", "founder"},
|
||||||
|
|||||||
Reference in New Issue
Block a user