Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow both 'fen' and 'user' in '#friend' URL (for the lobby) #14511

Merged
merged 1 commit into from Jan 21, 2024

Conversation

zamfofex
Copy link
Contributor

This is going to be useful for LeelaKnightOdds and LeelaQueenForKnight. 馃檪

@Naphthalin
Copy link

Thanks for that addition! Allowing to challenge either of the piece odds bots directly via a link already containing the suitable positions would make things a lot more convenient, especially for new challengers.

const forceOptions: ForceSetupOptions = {};
const urlParams = new URLSearchParams(location.search);
const friendUser = urlParams.get('user') ?? undefined;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is adding ?? undefined necessary here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

params.get(...) returns null when the parameter is not found (i.e. string | null), but the friendUser argument of openModal a few lines below accepts string | undefined, so the null value has to be converted to undefined.

@ornicar ornicar merged commit 527bbc7 into lichess-org:master Jan 21, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants