From 5cd0c11b0c83e43e8bb1b83e51637068215e075f Mon Sep 17 00:00:00 2001 From: SirStendec Date: Wed, 29 Aug 2018 19:03:10 -0400 Subject: [PATCH] 4.0.0-rc12.17 * Added: Setting to disable player auto-play. (Closes #515) * Fixed: Cheers not appearing in chat messages. * Fixed: Reasons not working for timeouts / bans in in-line actions. (Closes #513) --- src/main.js | 2 +- src/modules/chat/actions/types.jsx | 4 ++-- src/modules/chat/tokenizers.jsx | 19 ++++++++----------- src/sites/twitch-twilight/modules/player.jsx | 12 +++++++++++- 4 files changed, 22 insertions(+), 15 deletions(-) diff --git a/src/main.js b/src/main.js index a77daaf0..2158666d 100644 --- a/src/main.js +++ b/src/main.js @@ -100,7 +100,7 @@ class FrankerFaceZ extends Module { FrankerFaceZ.Logger = Logger; const VER = FrankerFaceZ.version_info = { - major: 4, minor: 0, revision: 0, extra: '-rc12.16', + major: 4, minor: 0, revision: 0, extra: '-rc12.17', commit: __git_commit__, build: __webpack_hash__, toString: () => diff --git a/src/modules/chat/actions/types.jsx b/src/modules/chat/actions/types.jsx index 163a99de..cf2c82f8 100644 --- a/src/modules/chat/actions/types.jsx +++ b/src/modules/chat/actions/types.jsx @@ -136,7 +136,7 @@ export const ban = { }, click(event, data) { - this.sendMessage(data.room.login, `/ban ${data.user.login} ${data.reason||''}`); + this.sendMessage(data.room.login, `/ban ${data.user.login} ${data.reason||data.options.reason||''}`); } } @@ -177,7 +177,7 @@ export const timeout = { }, click(event, data) { - this.sendMessage(data.room.login, `/timeout ${data.user.login} ${data.options.duration} ${data.reason||''}`); + this.sendMessage(data.room.login, `/timeout ${data.user.login} ${data.options.duration} ${data.reason||data.options.reason||''}`); } } diff --git a/src/modules/chat/tokenizers.jsx b/src/modules/chat/tokenizers.jsx index e1bc4cf8..50342e09 100644 --- a/src/modules/chat/tokenizers.jsx +++ b/src/modules/chat/tokenizers.jsx @@ -482,16 +482,13 @@ export const CheerEmotes = { if ( ! tokens || ! tokens.length || ! msg.bits ) return tokens; - // TODO: Store the room onto the chat message so we don't need to look this up. - const SiteChat = this.resolve('site.chat'), - chat = SiteChat && SiteChat.currentChat, - bitsConfig = chat && chat.props.bitsConfig; + const room = this.getRoom(msg.roomID, msg.roomLogin, true), + actions = room && room.bitsConfig; - if ( ! bitsConfig ) + if ( ! actions ) return tokens; - const actions = bitsConfig.indexedActions, - matcher = new RegExp(`^(${Object.keys(actions).join('|')})(\\d+)$`, 'i'); + const matcher = new RegExp(`^(${Object.keys(actions).join('|')})(\\d+)$`, 'i'); const out = [], collected = {}, @@ -516,11 +513,11 @@ export const CheerEmotes = { } const amount = parseInt(match[2], 10), - tiers = cheer.orderedTiers; + tiers = cheer.tiers; let tier, token; for(let i=0, l = tiers.length; i < l; i++) - if ( amount >= tiers[i].bits ) { + if ( amount >= tiers[i].amount ) { tier = i; break; } @@ -566,11 +563,11 @@ export const CheerEmotes = { if ( has(collected, prefix) ) { const cheers = collected[prefix], cheer = actions[prefix], - tiers = cheer.orderedTiers; + tiers = cheer.tiers; let tier = 0; for(let l = tiers.length; tier < l; tier++) - if ( cheers.total >= tiers[tier].bits ) + if ( cheers.total >= tiers[tier].amount ) break; out.unshift({ diff --git a/src/sites/twitch-twilight/modules/player.jsx b/src/sites/twitch-twilight/modules/player.jsx index 148fd298..d4ca5cb4 100644 --- a/src/sites/twitch-twilight/modules/player.jsx +++ b/src/sites/twitch-twilight/modules/player.jsx @@ -137,6 +137,16 @@ export default class Player extends Module { }, }); + this.settings.add('player.no-autoplay', { + default: false, + ui: { + path: 'Channel > Player >> Playback', + title: 'Do not automatically start playing videos or streams.', + description: 'Note: This feature does not apply when navigating directly from channel to channel.', + component: 'setting-check-box' + } + }); + this.settings.add('player.vod.autoplay', { default: true, ui: { @@ -265,7 +275,7 @@ export default class Player extends Module { if ( this.settings.get('player.theatre.auto-enter') && inst.onTheatreChange ) inst.onTheatreChange(true); - if ( ! this.settings.get('player.home.autoplay') && this.router.current.name === 'front-page' ) { + if ( this.settings.get('player.no-autoplay') || (! this.settings.get('player.home.autoplay') && this.router.current.name === 'front-page') ) { if ( inst.player ) this.disableAutoplay(inst); else {