Right now, there's a really bad user experience if you typo the hostname on zulipchat.com, see https://chat.zulip.org/#narrow/stream/16-desktop/subject/adding.20org.20that.20doesn't.20exist/near/646444.
From https://github.com/zulip/zulip-electron/pull/236#issuecomment-414450918, there's a proposed solution that should work great:
We could definitely fix while keeping backwards-compatibility that by paying attention to the error codes from /server_settings. You get a 400 error with this content for invalid subdomains:
tabbott@zaset:~$ curl https://zadsfasd.zulipchat.com/api/v1/server_settings
{"code":"BAD_REQUEST","result":"error","msg":"Invalid subdomain"}
And that's very different from the 404; we should only check for zulip.ogg if we get a 404 error back from /server_settings.
@timabbott @akashnimare the validation workflow is actually a bit different if you're adding idontexist.zulipchat.com than if you add i-exist-but-have-no-org-created.myselfhostedzulip.com
When dealing with a self-hosted instance, /api/v1/server_settings does return a 200 response, but realm_icon doesn't exist and there's no check for that, so the app is stuck but not in the same way that what's happening with misspelled zulipchat.com instances.
I'd be happy to help tackling this one.
I'd love to see this fixed while we're dealing with #596.
@zulipbot claim
Hello @Swapnilr1, it looks like you've currently claimed 1 issue in this repository. We encourage new contributors to focus their efforts on at most 1 issue at a time, so please complete your work on your other claimed issues before trying to claim this issue again.
We look forward to your valuable contributions!
@timabbott Can I work on this?
You can work on this @Swapnilr1 . It is encouraged for new contributors to focus their efforts on at most 1 issue at a time. Since you have already made a PR for your previous issue and no one else is working on this one, you can take this up.
we should only check for zulip.ogg if we get a 404 error back from /server_settings.
@timabbott if we get a 404 from /server_settings and a 200 from zulip.ogg, from where should we fetch the server settings like realm_icon?
If one gets a 404 from /server_settings and a 200 from zulip.ogg, then the server is running a very old version of Zulip. However, this issue is more than a year old, and the situation has changed, both in terms of how ancient Zulip 1.6.0 (the first version with /server_settings) and also the fact that our master branch won't be auto-updated to from old versions of the app on macOS and Windows . So here's my new proposal for mid-2019:
/server_settings, and if it isn't available, we report that the server isn't a Zulip server.Sound good?
@kanishk98 ^^ FYI.