Skip to content

Commit

Permalink
Fix #360
Browse files Browse the repository at this point in the history
  • Loading branch information
younesaassila committed Feb 1, 2025
1 parent 3536898 commit 2ce563b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 18 deletions.
5 changes: 2 additions & 3 deletions src/common/ts/isChannelWhitelisted.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
8 changes: 3 additions & 5 deletions src/common/ts/wasChannelSubscriber.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
);
}
20 changes: 10 additions & 10 deletions src/page/getFetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -651,23 +651,23 @@ 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(
channelName: string | null | undefined,
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(
Expand Down

0 comments on commit 2ce563b

Please sign in to comment.