Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions src/components/Hyperchat.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
};
</script>

Expand Down
3 changes: 2 additions & 1 deletion src/ts/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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<null | ChatReportUserOptions>;
Expand Down
Loading