-
Notifications
You must be signed in to change notification settings - Fork 2k
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Domains: Improve copy for TLDs unavailable for registration on WordPress.com #7300
Conversation
Product looks good to me 👍 |
message = this.translate( 'Sorry but %(domain)s cannot be registered on WordPress.com.', { | ||
args: { domain: domain } | ||
} ); | ||
const tldIndex = domain.lastIndexOf( '.' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about SLDs? (.co.uk e.g.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a isSubdomain
function in https://github.com/Automattic/wp-calypso/blob/master/client/lib/domains/index.js#L114 which might be useful
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I realized that it will do that for SLDs - but the sentence remains true. The domains "ends with .uk". I'm not familiar with any SLD which we don't allow registrations but allow registrations for the TLD of that SLD (ugh, hope that's clear). So, for co.uk
we don't support .co.uk
nor do we support .uk
.
Why not just use the SLD in the notice? I can't figure out an easy way to reliably extract SLDs, if present. Picking just the TLD is safer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The whole point of the message is about the domains we don't support though. A straightforward, non-optimized way could be to count the dots and make use of the isSubdomain
function;
if (dots.length == 1) {
// TLD
} else if ( isSubdomain( domain ) ) {
// TLD (also subdomain)
} else {
// SLD (grab last 2 dots)
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason why I've not opted for such a solution is because unfortunately it's not as straightforward (as it usually is with domains). The isSubdomain
function is very simple and dumb - it checks for 2-3 characters long tokens between dots and assumes those are TLD/SLDs. But there are many >3 character long SLDs (.school.za
, .csiro.au
, .film.hu
, etc.) and there are many 2-3 character long domain names (cnn.com is an obvious one, az.pl is another example). The only reliable way is to have a hardcoded list of all the possible SLDs - something we can't afford on the frontend and doesn't seem worth a trip to the backend. Hence my proposal to just use the TLD part. It's not ideal, but I think given the situation is the optimal solution (it's better to stick to something we are more certain of than to confuse the user with guessing if we're dealing with a TLD/SLD/subdomain).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still think handling co.uk.
is more important than some super rare domains. But if you are feeling strongly towards handling it this way I think that's alright as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could add this info in the error response from the server? You get the TLD extracted there anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that's probably the best to do it - I'll try to do that in a separate patch in the meantime (though, I admit, it's not high priority 😉).
Our node version has been bumped to 6.1.0 since this branch has been created. So it needs a rebase :) |
Unused imports and too long lines.
389dd99
to
a8c8398
Compare
I did the rebase everything seems OK. This is good to go, is there possibility of a delay when we try to determine whether the domain is registered or not? Like when the user registers a domain elsewhere and comes to our site right after and sees this message? In a sense, they already came here to "add" their domain. It's certainly better than what we had before but I think it's something to think about for future. |
That's a good point. It's probably highly dependent on the registrar - how fast they update/propagate. @spncrb, can you keep an eye out for such cases and let me know if they are confusing for users? |
Fixes #6810
Before, the error message was not very helpful (and it was shown as an intimidating error):
Now, the copy has been improved (thank you, @ranh!) and the notice has
info
severity:The
Learn more
link points tohttps://en.support.wordpress.com/map-existing-domain/
./cc @aidvu @umurkontaci for code review
/cc @spncrb
Test live: https://calypso.live/?branch=fix/tld-error-message