1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-09-17 10:16:57 +00:00

4.0.0-rc20.4

* Fixed: Infinite loop bug with badges. Sorry about that.
* Fixed: Bug with the Room Actions editor's preview check-boxes.
This commit is contained in:
SirStendec 2019-05-08 22:47:38 -04:00
parent 6dde27ca82
commit ba49d6b49c
5 changed files with 37 additions and 26 deletions

View file

@ -277,7 +277,7 @@ export default class Badges extends Module {
const p = d.provider;
if ( p === 'twitch' ) {
const bd = this.getTwitchBadge(d.badge, d.version, room_id, room_login),
global_badge = this.getTwitchBadge(d.badge, d.version) || {};
global_badge = this.getTwitchBadge(d.badge, d.version, null, null, true) || {};
if ( ! bd )
continue;
@ -628,16 +628,10 @@ export default class Badges extends Module {
// Twitch Badges
// ========================================================================
getTwitchBadge(badge, version, room_id, room_login) {
getTwitchBadge(badge, version, room_id, room_login, retried = false) {
const room = this.parent.getRoom(room_id, room_login, true);
let b;
if ( (room && ! room.badges) || ! this.twitch_badges ) {
const chat = this.resolve('site.chat');
if ( chat && chat.tryUpdateBadges )
chat.tryUpdateBadges();
}
if ( room ) {
const versions = room.badges && room.badges[badge];
b = versions && versions[version];
@ -648,14 +642,21 @@ export default class Badges extends Module {
b = versions && versions[version];
}
if ( ! b && ! retried ) {
const chat = this.resolve('site.chat');
if ( chat && chat.tryUpdateBadges )
chat.tryUpdateBadges();
}
return b;
}
hasTwitchBadges() {
return !! this.twitch_badges
getTwitchBadgeCount() {
return this.twitch_badge_count || 0;
}
updateTwitchBadges(badges) {
this.twitch_badge_count = 0;
if ( ! Array.isArray(badges) )
this.twitch_badges = badges;
else {
@ -666,6 +667,7 @@ export default class Badges extends Module {
const sid = data.setID,
bs = b[sid] = b[sid] || {__game: /_\d+$/.test(sid)};
this.twitch_badge_count++;
bs[data.version] = data;
}
}