Support using follower emotes outside of channel if subbed (#4922)
If we also have a subscriber emote set for a channel, then don't treat a follower emote set as local to that channel. Co-authored-by: iProdigy <8106344+iProdigy@users.noreply.github.com>
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
## Unversioned
|
## Unversioned
|
||||||
|
|
||||||
|
- Major: Allow use of Twitch follower emotes in other channels if subscribed. (#4922)
|
||||||
- Minor: Migrate to the new Get Channel Followers Helix endpoint, fixing follower count not showing up in usercards. (#4809)
|
- Minor: Migrate to the new Get Channel Followers Helix endpoint, fixing follower count not showing up in usercards. (#4809)
|
||||||
- Minor: The account switcher is now styled to match your theme. (#4817)
|
- Minor: The account switcher is now styled to match your theme. (#4817)
|
||||||
- Minor: Add an invisible resize handle to the bottom of frameless user info popups and reply thread popups. (#4795)
|
- Minor: Add an invisible resize handle to the bottom of frameless user info popups and reply thread popups. (#4795)
|
||||||
|
|||||||
@@ -264,12 +264,33 @@ void TwitchAccount::loadUserstateEmotes(std::weak_ptr<Channel> weakChannel)
|
|||||||
[this, weakChannel](QJsonArray emoteSetArray) {
|
[this, weakChannel](QJsonArray emoteSetArray) {
|
||||||
auto emoteData = this->emotes_.access();
|
auto emoteData = this->emotes_.access();
|
||||||
auto localEmoteData = this->localEmotes_.access();
|
auto localEmoteData = this->localEmotes_.access();
|
||||||
for (auto emoteSet_ : emoteSetArray)
|
|
||||||
|
std::unordered_set<QString> subscriberChannelIDs;
|
||||||
|
std::vector<IvrEmoteSet> ivrEmoteSets;
|
||||||
|
ivrEmoteSets.reserve(emoteSetArray.size());
|
||||||
|
|
||||||
|
for (auto emoteSet : emoteSetArray)
|
||||||
|
{
|
||||||
|
IvrEmoteSet ivrEmoteSet(emoteSet.toObject());
|
||||||
|
if (!ivrEmoteSet.tier.isNull())
|
||||||
|
{
|
||||||
|
subscriberChannelIDs.insert(ivrEmoteSet.channelId);
|
||||||
|
}
|
||||||
|
ivrEmoteSets.emplace_back(ivrEmoteSet);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const auto &emoteSet : emoteData->emoteSets)
|
||||||
|
{
|
||||||
|
if (emoteSet->subscriber)
|
||||||
|
{
|
||||||
|
subscriberChannelIDs.insert(emoteSet->channelID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const auto &ivrEmoteSet : ivrEmoteSets)
|
||||||
{
|
{
|
||||||
auto emoteSet = std::make_shared<EmoteSet>();
|
auto emoteSet = std::make_shared<EmoteSet>();
|
||||||
|
|
||||||
IvrEmoteSet ivrEmoteSet(emoteSet_.toObject());
|
|
||||||
|
|
||||||
QString setKey = ivrEmoteSet.setId;
|
QString setKey = ivrEmoteSet.setId;
|
||||||
emoteSet->key = setKey;
|
emoteSet->key = setKey;
|
||||||
|
|
||||||
@@ -285,8 +306,15 @@ void TwitchAccount::loadUserstateEmotes(std::weak_ptr<Channel> weakChannel)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
emoteSet->channelID = ivrEmoteSet.channelId;
|
||||||
emoteSet->channelName = ivrEmoteSet.login;
|
emoteSet->channelName = ivrEmoteSet.login;
|
||||||
emoteSet->text = ivrEmoteSet.displayName;
|
emoteSet->text = ivrEmoteSet.displayName;
|
||||||
|
emoteSet->subscriber = !ivrEmoteSet.tier.isNull();
|
||||||
|
|
||||||
|
// NOTE: If a user does not have a subscriber emote set, but a follower emote set, this logic will be wrong
|
||||||
|
// However, that's not a realistic problem.
|
||||||
|
bool haveSubscriberSetForChannel =
|
||||||
|
subscriberChannelIDs.contains(ivrEmoteSet.channelId);
|
||||||
|
|
||||||
for (const auto &emoteObj : ivrEmoteSet.emotes)
|
for (const auto &emoteObj : ivrEmoteSet.emotes)
|
||||||
{
|
{
|
||||||
@@ -302,7 +330,9 @@ void TwitchAccount::loadUserstateEmotes(std::weak_ptr<Channel> weakChannel)
|
|||||||
getApp()->emotes->twitch.getOrCreateEmote(id, code);
|
getApp()->emotes->twitch.getOrCreateEmote(id, code);
|
||||||
|
|
||||||
// Follower emotes can be only used in their origin channel
|
// Follower emotes can be only used in their origin channel
|
||||||
if (ivrEmote.emoteType == "FOLLOWER")
|
// unless the user is subscribed, then they can be used anywhere.
|
||||||
|
if (ivrEmote.emoteType == "FOLLOWER" &&
|
||||||
|
!haveSubscriberSetForChannel)
|
||||||
{
|
{
|
||||||
emoteSet->local = true;
|
emoteSet->local = true;
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,9 @@ public:
|
|||||||
struct EmoteSet {
|
struct EmoteSet {
|
||||||
QString key;
|
QString key;
|
||||||
QString channelName;
|
QString channelName;
|
||||||
|
QString channelID;
|
||||||
QString text;
|
QString text;
|
||||||
|
bool subscriber{false};
|
||||||
bool local{false};
|
bool local{false};
|
||||||
std::vector<TwitchEmote> emotes;
|
std::vector<TwitchEmote> emotes;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user