diff --git a/assets/chat/js/messages/ChatBroadcastMessage.js b/assets/chat/js/messages/ChatBroadcastMessage.js index 18577b57..67a24d9e 100644 --- a/assets/chat/js/messages/ChatBroadcastMessage.js +++ b/assets/chat/js/messages/ChatBroadcastMessage.js @@ -21,7 +21,7 @@ export default class ChatBroadcastMessage extends ChatEventMessage { .querySelector('#user-template') ?.content.cloneNode(true).firstElementChild; user.title = this.title; - user.classList.add(colorFlair?.name); + if (colorFlair) user.classList.add(colorFlair.name); user.innerText = this.user.displayName; const ctrl = document.createElement('span'); diff --git a/assets/chat/js/messages/ChatDonationMessage.js b/assets/chat/js/messages/ChatDonationMessage.js index 1234e01f..f3de6e76 100644 --- a/assets/chat/js/messages/ChatDonationMessage.js +++ b/assets/chat/js/messages/ChatDonationMessage.js @@ -33,7 +33,7 @@ export default class ChatDonationMessage extends ChatEventMessage { const colorFlair = usernameColorFlair(chat.flairs, this.user); user.title = this.title; - user.classList.add(colorFlair?.name); + if (colorFlair) user.classList.add(colorFlair.name); user.innerText = this.user.displayName; eventTemplate.querySelector('.event-info').append( diff --git a/assets/chat/js/messages/ChatUserMessage.js b/assets/chat/js/messages/ChatUserMessage.js index 0beb5297..c933d472 100644 --- a/assets/chat/js/messages/ChatUserMessage.js +++ b/assets/chat/js/messages/ChatUserMessage.js @@ -63,7 +63,9 @@ export default class ChatUserMessage extends ChatMessage { const colorFlair = usernameColorFlair(chat.flairs, this.user); const user = `${this.buildFeatures(this.user, chat)} ${this.user.displayName}`; + }" class="${['user', colorFlair?.name].filter(Boolean).join(' ')}">${ + this.user.displayName + }`; return this.wrap( `${this.buildTime()} ${user}${ctrl} ${this.buildMessageTxt( chat, diff --git a/assets/chat/js/messages/subscriptions/ChatGiftedSubscriptionMessage.js b/assets/chat/js/messages/subscriptions/ChatGiftedSubscriptionMessage.js index f3d662f5..b0e39ea6 100644 --- a/assets/chat/js/messages/subscriptions/ChatGiftedSubscriptionMessage.js +++ b/assets/chat/js/messages/subscriptions/ChatGiftedSubscriptionMessage.js @@ -32,7 +32,7 @@ export default class ChatGiftedSubscriptionMessage extends ChatSubscriptionMessa ?.content.cloneNode(true).firstElementChild; const gifteeColorFlair = usernameColorFlair(chat.flairs, this.giftee); - giftee.classList.add(gifteeColorFlair?.name); + if (gifteeColorFlair) giftee.classList.add(gifteeColorFlair.name); giftee.innerText = this.giftee.displayName; const subscriptionInfo = message.querySelector('.event-info'); diff --git a/assets/chat/js/messages/subscriptions/ChatSubscriptionMessage.js b/assets/chat/js/messages/subscriptions/ChatSubscriptionMessage.js index 4ea3e7d0..7a076d3b 100644 --- a/assets/chat/js/messages/subscriptions/ChatSubscriptionMessage.js +++ b/assets/chat/js/messages/subscriptions/ChatSubscriptionMessage.js @@ -39,7 +39,7 @@ export default class ChatSubscriptionMessage extends ChatEventMessage { .querySelector('#user-template') ?.content.cloneNode(true).firstElementChild; user.title = this.title; - user.classList.add(colorFlair?.name); + if (colorFlair) user.classList.add(colorFlair.name); user.innerText = this.user.displayName; const tierLabel = this.tierLabel ?? `Tier ${this.tier}`;