diff --git a/src/components/Hyperchat.svelte b/src/components/Hyperchat.svelte index a1eda6e4..824a01ef 100644 --- a/src/components/Hyperchat.svelte +++ b/src/components/Hyperchat.svelte @@ -445,13 +445,11 @@ $: $enableStickySuperchatBar, hasBanner, topBarResized(); const isMention = (msg: Ytc.ParsedMessage) => { - return $selfChannelName && msg.message.map(run => { - if (run.type === 'text' || run.type === 'link') { - return run.text; - } else { - return run.alt; - } - }).join('').includes(`@${$selfChannelName}`); + return $selfChannelName && + msg.message + .reduce((text, run) => + text + ((run.type === 'text' || run.type === 'link') ? run.text : run.alt), '') + .includes(`@${$selfChannelName}`); }; diff --git a/src/ts/storage.ts b/src/ts/storage.ts index 1c27ed03..f595bf70 100644 --- a/src/ts/storage.ts +++ b/src/ts/storage.ts @@ -4,6 +4,7 @@ import type { Writable } from 'svelte/store'; import { getClient, AvailableLanguages } from 'iframe-translator'; import type { IframeTranslatorClient, AvailableLanguageCodes } from 'iframe-translator'; import { ChatReportUserOptions, Theme, YoutubeEmojiRenderMode } from './chat-constants'; +import { formatAuthorName } from './component-utils'; import { createLiveTLTranslatorClient, shouldUseLiveTLTranslatorBridge } from './ltl-translation'; export const stores = webExtStores(); @@ -63,7 +64,7 @@ export const focusedSuperchat = writable(null as null | Ytc.ParsedTimedItem); export const port = writable(null as null | Chat.Port); export const selfChannel = writable(null as null | SimpleUserInfo); export const selfChannelId = derived(selfChannel, ($selfChannel) => $selfChannel?.channelId); -export const selfChannelName = derived(selfChannel, ($selfChannel) => $selfChannel?.name); +export const selfChannelName = derived(selfChannel, ($selfChannel) => formatAuthorName($selfChannel?.name ?? '')); export const reportDialog = writable(null as null | { callback: (selection: ChatReportUserOptions) => void; optionStore: Writable;