From 6f119bd93dceeb01f26edf6172ddcd074fec3b25 Mon Sep 17 00:00:00 2001 From: Manzoor Wani Date: Wed, 23 Oct 2024 10:45:40 +0530 Subject: [PATCH] Social: Fix Bluesky custom domain handle not being accepted --- .../fix-social-bluesky-custom-domain-handles-not-working | 4 ++++ .../src/components/services/use-request-access.ts | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) create mode 100644 projects/js-packages/publicize-components/changelog/fix-social-bluesky-custom-domain-handles-not-working diff --git a/projects/js-packages/publicize-components/changelog/fix-social-bluesky-custom-domain-handles-not-working b/projects/js-packages/publicize-components/changelog/fix-social-bluesky-custom-domain-handles-not-working new file mode 100644 index 0000000000000..5857f3006fd35 --- /dev/null +++ b/projects/js-packages/publicize-components/changelog/fix-social-bluesky-custom-domain-handles-not-working @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Social: Fixed Bluesky custom domain handle not being accepted diff --git a/projects/js-packages/publicize-components/src/components/services/use-request-access.ts b/projects/js-packages/publicize-components/src/components/services/use-request-access.ts index e12af39dfefca..5a5ea00117b4a 100644 --- a/projects/js-packages/publicize-components/src/components/services/use-request-access.ts +++ b/projects/js-packages/publicize-components/src/components/services/use-request-access.ts @@ -11,10 +11,10 @@ const isValidMastodonUsername = ( username: string ) => /** * Example valid handles: + * - domain.tld * - username.bsky.social * - user-name.bsky.social - * - my_domain.com.bsky.social - * - my-domain.com.my-own-server.com + * - my-domain.com * * @param {string} handle - Handle to validate * @@ -23,8 +23,8 @@ const isValidMastodonUsername = ( username: string ) => function isValidBlueskyHandle( handle: string ) { const parts = handle.split( '.' ).filter( Boolean ); - // A valid handle should have at least 3 parts - username, domain, and tld - if ( parts.length < 3 ) { + // A valid handle should have at least 2 parts - domain, and tld + if ( parts.length < 2 ) { return false; }