This commit is contained in:
Younes Aassila 2025-02-01 13:34:52 +01:00
parent 3536898e23
commit 2ce563b271
No known key found for this signature in database
3 changed files with 15 additions and 18 deletions

View File

@ -4,8 +4,7 @@ export default function isChannelWhitelisted(
channelName: string | null channelName: string | null
): boolean { ): boolean {
if (!channelName) return false; if (!channelName) return false;
const whitelistedChannelsLower = store.state.whitelistedChannels.map( return store.state.whitelistedChannels.some(
channel => channel.toLowerCase() c => c.toLowerCase() === channelName.toLowerCase()
); );
return whitelistedChannelsLower.includes(channelName.toLowerCase());
} }

View File

@ -4,9 +4,7 @@ export default function wasChannelSubscriber(
channelName: string | null channelName: string | null
): boolean { ): boolean {
if (!channelName) return false; if (!channelName) return false;
const activeChannelSubscriptionsLower = return store.state.activeChannelSubscriptions.some(
store.state.activeChannelSubscriptions.map(channel => c => c.toLowerCase() === channelName.toLowerCase()
channel.toLowerCase()
); );
return activeChannelSubscriptionsLower.includes(channelName.toLowerCase());
} }

View File

@ -651,11 +651,11 @@ function isChannelWhitelisted(
pageState: PageState pageState: PageState
): boolean { ): boolean {
if (!channelName) return false; if (!channelName) return false;
const whitelistedChannelsLower = return (
pageState.state?.whitelistedChannels.map(channel => pageState.state?.whitelistedChannels.some(
channel.toLowerCase() c => c.toLowerCase() === channelName.toLowerCase()
) ?? []; ) ?? false
return whitelistedChannelsLower.includes(channelName.toLowerCase()); );
} }
function wasChannelSubscriber( function wasChannelSubscriber(
@ -663,11 +663,11 @@ function wasChannelSubscriber(
pageState: PageState pageState: PageState
): boolean { ): boolean {
if (!channelName) return false; if (!channelName) return false;
const activeChannelSubscriptionsLower = return (
pageState.state?.activeChannelSubscriptions.map(channel => pageState.state?.activeChannelSubscriptions.some(
channel.toLowerCase() c => c.toLowerCase() === channelName.toLowerCase()
) ?? []; ) ?? false
return activeChannelSubscriptionsLower.includes(channelName.toLowerCase()); );
} }
async function flagRequest( async function flagRequest(