diff --git a/src/common/ts/isChannelWhitelisted.ts b/src/common/ts/isChannelWhitelisted.ts index 1f8b426..88364f0 100644 --- a/src/common/ts/isChannelWhitelisted.ts +++ b/src/common/ts/isChannelWhitelisted.ts @@ -4,8 +4,7 @@ export default function isChannelWhitelisted( channelName: string | null ): boolean { if (!channelName) return false; - const whitelistedChannelsLower = store.state.whitelistedChannels.map( - channel => channel.toLowerCase() + return store.state.whitelistedChannels.some( + c => c.toLowerCase() === channelName.toLowerCase() ); - return whitelistedChannelsLower.includes(channelName.toLowerCase()); } diff --git a/src/common/ts/wasChannelSubscriber.ts b/src/common/ts/wasChannelSubscriber.ts index 0a37243..be45e79 100644 --- a/src/common/ts/wasChannelSubscriber.ts +++ b/src/common/ts/wasChannelSubscriber.ts @@ -4,9 +4,7 @@ export default function wasChannelSubscriber( channelName: string | null ): boolean { if (!channelName) return false; - const activeChannelSubscriptionsLower = - store.state.activeChannelSubscriptions.map(channel => - channel.toLowerCase() - ); - return activeChannelSubscriptionsLower.includes(channelName.toLowerCase()); + return store.state.activeChannelSubscriptions.some( + c => c.toLowerCase() === channelName.toLowerCase() + ); } diff --git a/src/page/getFetch.ts b/src/page/getFetch.ts index b65dca1..dc2e42d 100644 --- a/src/page/getFetch.ts +++ b/src/page/getFetch.ts @@ -651,11 +651,11 @@ function isChannelWhitelisted( pageState: PageState ): boolean { if (!channelName) return false; - const whitelistedChannelsLower = - pageState.state?.whitelistedChannels.map(channel => - channel.toLowerCase() - ) ?? []; - return whitelistedChannelsLower.includes(channelName.toLowerCase()); + return ( + pageState.state?.whitelistedChannels.some( + c => c.toLowerCase() === channelName.toLowerCase() + ) ?? false + ); } function wasChannelSubscriber( @@ -663,11 +663,11 @@ function wasChannelSubscriber( pageState: PageState ): boolean { if (!channelName) return false; - const activeChannelSubscriptionsLower = - pageState.state?.activeChannelSubscriptions.map(channel => - channel.toLowerCase() - ) ?? []; - return activeChannelSubscriptionsLower.includes(channelName.toLowerCase()); + return ( + pageState.state?.activeChannelSubscriptions.some( + c => c.toLowerCase() === channelName.toLowerCase() + ) ?? false + ); } async function flagRequest(