mirror of
https://github.com/FrankerFaceZ/FrankerFaceZ.git
synced 2025-07-24 11:38:30 +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:
parent
6dde27ca82
commit
ba49d6b49c
5 changed files with 37 additions and 26 deletions
|
@ -149,7 +149,7 @@ ${typeof x[1] === 'string' ? x[1] : JSON.stringify(x[1], null, 4)}`
|
|||
FrankerFaceZ.Logger = Logger;
|
||||
|
||||
const VER = FrankerFaceZ.version_info = {
|
||||
major: 4, minor: 0, revision: 0, extra: '-rc20.3',
|
||||
major: 4, minor: 0, revision: 0, extra: '-rc20.4',
|
||||
commit: __git_commit__,
|
||||
build: __webpack_hash__,
|
||||
toString: () =>
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -380,23 +380,23 @@ export default class Room {
|
|||
// Badge Data
|
||||
// ========================================================================
|
||||
|
||||
hasBadges() {
|
||||
return !! this.badges
|
||||
badgeCount() {
|
||||
return this.badge_count || 0;
|
||||
}
|
||||
|
||||
updateBadges(badges) {
|
||||
this.badge_count = 0;
|
||||
if ( ! Array.isArray(badges) )
|
||||
this.badges = badges;
|
||||
else {
|
||||
let b = null;
|
||||
if ( badges.length ) {
|
||||
b = {};
|
||||
// Rooms can have no badges, so we want to allow that.
|
||||
const b = {};
|
||||
for(const data of badges) {
|
||||
const sid = data.setID,
|
||||
bs = b[sid] = b[sid] || {};
|
||||
|
||||
bs[data.version] = data;
|
||||
}
|
||||
this.badge_count++;
|
||||
}
|
||||
|
||||
this.badges = b;
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
</label>
|
||||
</div>
|
||||
|
||||
<div v-if="item.inline && has_msg" class="tw-pd-x-1 tw-checkbox">
|
||||
<div v-if="has_msg" class="tw-pd-x-1 tw-checkbox">
|
||||
<input
|
||||
id="is_deleted"
|
||||
ref="is_deleted"
|
||||
|
@ -449,7 +449,7 @@ export default {
|
|||
this.is_moderator = this.$refs.as_mod.checked;
|
||||
this.is_staff = false; //this.$refs.as_staff.checked;
|
||||
this.with_mod_icons = this.item.inline && this.$refs.with_mod_icons.checked;
|
||||
this.is_deleted = this.item.inline && this.$refs.is_deleted.checked;
|
||||
this.is_deleted = this.has_msg && this.$refs.is_deleted.checked;
|
||||
},
|
||||
|
||||
displayAction(action) {
|
||||
|
|
|
@ -605,7 +605,16 @@ export default class ChatHook extends Module {
|
|||
|
||||
|
||||
tryUpdateBadges() {
|
||||
this.log.debug('Trying to update badge data from the chat container.');
|
||||
if ( !this._badge_timer )
|
||||
this._badge_timer = setTimeout(() => this._tryUpdateBadges(), 0);
|
||||
}
|
||||
|
||||
_tryUpdateBadges() {
|
||||
if ( this._badge_timer )
|
||||
clearTimeout(this._badge_timer);
|
||||
this._badge_timer = null;
|
||||
|
||||
this.log.info('Trying to update badge data from the chat container.');
|
||||
const inst = this.ChatContainer.first;
|
||||
if ( inst )
|
||||
this.containerUpdated(inst, inst.props);
|
||||
|
@ -1557,10 +1566,10 @@ export default class ChatHook extends Module {
|
|||
cs = data.user && data.user.broadcastBadges || [],
|
||||
ocs = odata.user && odata.user.broadcastBadges || [];
|
||||
|
||||
if ( ! this.chat.badges.hasTwitchBadges() || bs.length !== obs.length )
|
||||
if ( this.chat.badges.getTwitchBadgeCount() !== bs.length || bs.length !== obs.length )
|
||||
this.chat.badges.updateTwitchBadges(bs);
|
||||
|
||||
if ( ! this.hasRoomBadges(cont) || cs.length !== ocs.length )
|
||||
if ( cont._ffz_room.badgeCount() !== cs.length || cs.length !== ocs.length )
|
||||
this.updateRoomBadges(cont, cs);
|
||||
|
||||
this.updateRoomRules(cont, props.chatRules);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue