Skip to content

Commit

Permalink
fix collab bug that made it not work for room participants + fix bug …
Browse files Browse the repository at this point in the history
…where whitelisted emails weren't actually whitelisted
  • Loading branch information
Cosmin-Mare committed Nov 14, 2024
1 parent 0eafa34 commit bb9f0a2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/components/big-interactive-pages/editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ export default function Editor({ persistenceState, cookies, roomState }: EditorP
}, [initialCode]);

return (
isNewSaveStrat.value && persistenceState.value.kind === PersistenceStateKind.COLLAB && typeof persistenceState.value.game === 'string'
roomState != undefined && persistenceState.value.kind === PersistenceStateKind.COLLAB && typeof persistenceState.value.game === 'string'
?
(<>
<RoomPasswordPopup persistenceState={persistenceState} />
Expand Down
4 changes: 2 additions & 2 deletions src/lib/game-saving/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -347,11 +347,11 @@ async function hashCodeToBigInt(string : string) : Promise<bigint>{
}

export async function isAccountWhitelistedToUseCollabAndSavingBetaFeatures(id: string, email: string) : Promise<boolean>{
if(whitelistedBetaCollabAndSavingStratEmails.includes(email)) return true;
if(import.meta.env.PERCENT_OF_USERS_WHITELISTED_FOR_BETA_FEATURE == 0 || import.meta.env.PERCENT_OF_USERS_WHITELISTED_FOR_BETA_FEATURE == undefined) return false;
let hashedId = await hashCodeToBigInt(id);

if(hashedId % BigInt(100) < import.meta.env.PERCENT_OF_USERS_WHITELISTED_FOR_BETA_FEATURE ||
whitelistedBetaCollabAndSavingStratEmails.includes(email)){
if(hashedId % BigInt(100) < import.meta.env.PERCENT_OF_USERS_WHITELISTED_FOR_BETA_FEATURE){
return true
}
return false;
Expand Down

0 comments on commit bb9f0a2

Please sign in to comment.