fix: implement legacy profile guard behavior (redirect to home)
Based on legacy app (web/app/assets/javascripts/wizard/gear_utils.js): When canPlayWithOthers() fails (single-player profile detected): - Legacy app shows dialog with options: * Create private session → redirects to new session * Go to audio settings → redirects to /account/audio * Cancel → redirects to home Current implementation (without dialog): - Reject with error.controlled_location = false - Redirect to home (/client) when profile check fails - Prevents user from joining with inadequate audio profile This matches legacy behavior of kicking user back to home, but WITHOUT the dialog that explains why or offers alternatives. TODO: Add JKSessionProfileDialog component with same options as legacy 'single-player-profile-dialog' for better UX. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
cff2c04732
commit
332ae61ba0
|
|
@ -376,10 +376,13 @@ const JKSessionScreen = () => {
|
|||
|
||||
} catch (error) {
|
||||
logger.error("User profile is not appropriate for session:", error);
|
||||
// If error doesn't control navigation, redirect to home (legacy behavior)
|
||||
if (!error?.controlled_location) {
|
||||
// Handle error without controlled_location
|
||||
// Session leave will be triggered by outer catch block
|
||||
logger.debug("Profile guard failed, redirecting to home");
|
||||
history.push('/client');
|
||||
return; // Don't continue with session join
|
||||
}
|
||||
// If controlled_location is true, the error handler already redirected
|
||||
}
|
||||
} catch (error) {
|
||||
logger.error("Error: waiting for session page enter to complete:", error);
|
||||
|
|
|
|||
|
|
@ -486,8 +486,16 @@ const useGearUtils = () => {
|
|||
const canPlayResult = await canPlayWithOthers();
|
||||
|
||||
if (!canPlayResult.canPlay) {
|
||||
const error = new Error('Cannot play with others - profile check failed');
|
||||
// TODO: Show dialog like legacy app with options:
|
||||
// - Create private session (controlled_location: true, redirect to new session)
|
||||
// - Go to audio settings (controlled_location: true, redirect to /account/audio)
|
||||
// - Cancel (controlled_location: false, redirect to home)
|
||||
|
||||
// For now, mimic legacy behavior: reject and let caller redirect to home
|
||||
const error = new Error('Cannot play with others - single player profile detected');
|
||||
error.canPlayResult = canPlayResult;
|
||||
error.controlled_location = false; // Let caller handle redirect
|
||||
error.reason = 'single_player_profile';
|
||||
reject(error);
|
||||
} else {
|
||||
resolve();
|
||||
|
|
|
|||
Loading…
Reference in New Issue