Implement review changes

This commit is contained in:
Younes Aassila 2025-02-02 14:24:14 +01:00
parent 7ab206e3d8
commit 2a79647fae
No known key found for this signature in database
4 changed files with 9 additions and 7 deletions

View File

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

View File

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

View File

@ -650,9 +650,10 @@ function isChannelWhitelisted(
pageState: PageState
): boolean {
if (!channelName) return false;
const channelNameLower = channelName.toLowerCase();
return (
pageState.state?.whitelistedChannels.some(
c => c.toLowerCase() === channelName.toLowerCase()
c => c.toLowerCase() === channelNameLower
) ?? false
);
}
@ -662,9 +663,10 @@ function wasChannelSubscriber(
pageState: PageState
): boolean {
if (!channelName) return false;
const channelNameLower = channelName.toLowerCase();
return (
pageState.state?.activeChannelSubscriptions.some(
c => c.toLowerCase() === channelName.toLowerCase()
c => c.toLowerCase() === channelNameLower
) ?? false
);
}

View File

@ -32,9 +32,7 @@ async function sendMessageAndWaitForResponse(
): Promise<any> {
return new Promise((resolve, reject) => {
if (!recipient) {
console.error("[TTV LOL PRO] Message recipient is undefined.");
resolve(undefined);
return;
return reject(new Error("Message recipient is undefined."));
}
const listener = (event: MessageEvent) => {