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;
|
FrankerFaceZ.Logger = Logger;
|
||||||
|
|
||||||
const VER = FrankerFaceZ.version_info = {
|
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__,
|
commit: __git_commit__,
|
||||||
build: __webpack_hash__,
|
build: __webpack_hash__,
|
||||||
toString: () =>
|
toString: () =>
|
||||||
|
|
|
@ -277,7 +277,7 @@ export default class Badges extends Module {
|
||||||
const p = d.provider;
|
const p = d.provider;
|
||||||
if ( p === 'twitch' ) {
|
if ( p === 'twitch' ) {
|
||||||
const bd = this.getTwitchBadge(d.badge, d.version, room_id, room_login),
|
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 )
|
if ( ! bd )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -628,16 +628,10 @@ export default class Badges extends Module {
|
||||||
// Twitch Badges
|
// 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);
|
const room = this.parent.getRoom(room_id, room_login, true);
|
||||||
let b;
|
let b;
|
||||||
|
|
||||||
if ( (room && ! room.badges) || ! this.twitch_badges ) {
|
|
||||||
const chat = this.resolve('site.chat');
|
|
||||||
if ( chat && chat.tryUpdateBadges )
|
|
||||||
chat.tryUpdateBadges();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( room ) {
|
if ( room ) {
|
||||||
const versions = room.badges && room.badges[badge];
|
const versions = room.badges && room.badges[badge];
|
||||||
b = versions && versions[version];
|
b = versions && versions[version];
|
||||||
|
@ -648,14 +642,21 @@ export default class Badges extends Module {
|
||||||
b = versions && versions[version];
|
b = versions && versions[version];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( ! b && ! retried ) {
|
||||||
|
const chat = this.resolve('site.chat');
|
||||||
|
if ( chat && chat.tryUpdateBadges )
|
||||||
|
chat.tryUpdateBadges();
|
||||||
|
}
|
||||||
|
|
||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
|
|
||||||
hasTwitchBadges() {
|
getTwitchBadgeCount() {
|
||||||
return !! this.twitch_badges
|
return this.twitch_badge_count || 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
updateTwitchBadges(badges) {
|
updateTwitchBadges(badges) {
|
||||||
|
this.twitch_badge_count = 0;
|
||||||
if ( ! Array.isArray(badges) )
|
if ( ! Array.isArray(badges) )
|
||||||
this.twitch_badges = badges;
|
this.twitch_badges = badges;
|
||||||
else {
|
else {
|
||||||
|
@ -666,6 +667,7 @@ export default class Badges extends Module {
|
||||||
const sid = data.setID,
|
const sid = data.setID,
|
||||||
bs = b[sid] = b[sid] || {__game: /_\d+$/.test(sid)};
|
bs = b[sid] = b[sid] || {__game: /_\d+$/.test(sid)};
|
||||||
|
|
||||||
|
this.twitch_badge_count++;
|
||||||
bs[data.version] = data;
|
bs[data.version] = data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -380,23 +380,23 @@ export default class Room {
|
||||||
// Badge Data
|
// Badge Data
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
|
|
||||||
hasBadges() {
|
badgeCount() {
|
||||||
return !! this.badges
|
return this.badge_count || 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
updateBadges(badges) {
|
updateBadges(badges) {
|
||||||
|
this.badge_count = 0;
|
||||||
if ( ! Array.isArray(badges) )
|
if ( ! Array.isArray(badges) )
|
||||||
this.badges = badges;
|
this.badges = badges;
|
||||||
else {
|
else {
|
||||||
let b = null;
|
// Rooms can have no badges, so we want to allow that.
|
||||||
if ( badges.length ) {
|
const b = {};
|
||||||
b = {};
|
for(const data of badges) {
|
||||||
for(const data of badges) {
|
const sid = data.setID,
|
||||||
const sid = data.setID,
|
bs = b[sid] = b[sid] || {};
|
||||||
bs = b[sid] = b[sid] || {};
|
|
||||||
|
|
||||||
bs[data.version] = data;
|
bs[data.version] = data;
|
||||||
}
|
this.badge_count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.badges = b;
|
this.badges = b;
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</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
|
<input
|
||||||
id="is_deleted"
|
id="is_deleted"
|
||||||
ref="is_deleted"
|
ref="is_deleted"
|
||||||
|
@ -449,7 +449,7 @@ export default {
|
||||||
this.is_moderator = this.$refs.as_mod.checked;
|
this.is_moderator = this.$refs.as_mod.checked;
|
||||||
this.is_staff = false; //this.$refs.as_staff.checked;
|
this.is_staff = false; //this.$refs.as_staff.checked;
|
||||||
this.with_mod_icons = this.item.inline && this.$refs.with_mod_icons.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) {
|
displayAction(action) {
|
||||||
|
|
|
@ -605,7 +605,16 @@ export default class ChatHook extends Module {
|
||||||
|
|
||||||
|
|
||||||
tryUpdateBadges() {
|
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;
|
const inst = this.ChatContainer.first;
|
||||||
if ( inst )
|
if ( inst )
|
||||||
this.containerUpdated(inst, inst.props);
|
this.containerUpdated(inst, inst.props);
|
||||||
|
@ -1557,10 +1566,10 @@ export default class ChatHook extends Module {
|
||||||
cs = data.user && data.user.broadcastBadges || [],
|
cs = data.user && data.user.broadcastBadges || [],
|
||||||
ocs = odata.user && odata.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);
|
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.updateRoomBadges(cont, cs);
|
||||||
|
|
||||||
this.updateRoomRules(cont, props.chatRules);
|
this.updateRoomRules(cont, props.chatRules);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue