1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-07-25 12:08:30 +00:00

Fix duplicate turbo/prime emotes in self-sent messages, and other future cases where two emotes have the same indices.

This commit is contained in:
SirStendec 2017-11-14 22:11:58 -05:00
parent bb26260e23
commit 2c28afc6a6

View file

@ -306,6 +306,7 @@ 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;
@ -634,7 +635,7 @@ export const TwitchEmotes = {
if ( ! e_length )
return tokens;
emotes.sort((a,b) => a[1] - b[1]);
emotes.sort((a,b) => a[1] !== b[1] ? a[1] - b[1] : b[0] - a[0]);
let idx = 0,
eix = 0;
@ -675,6 +676,12 @@ export const TwitchEmotes = {
break;
}
// If this emote starts before the current index, skip it.
if ( e_start < idx ) {
eix++;
continue;
}
// If there's text at the beginning of the token that
// isn't part of this emote, output it.
if ( e_start > idx )