@@ -56,12 +56,13 @@ export function initNewServerForm({$root, onChange}: NewServerFormProps): void {
5656 "input.setting-input-value" ,
5757 ) ! ;
5858
59- < < < << << HEAD
6059 async function submitFormHandler ( ) : Promise < void > {
6160 $saveServerButton . textContent = "Connecting..." ;
6261 let serverConf ;
6362 try {
64- serverConf = await DomainUtil . checkDomain ( $newServerUrl . value . trim ( ) ) ;
63+ serverConf = await DomainUtil . checkDomain (
64+ await autoComplete ( $newServerUrl . value . trim ( ) ) ,
65+ ) ;
6566 } catch ( error : unknown ) {
6667 $saveServerButton . textContent = "Connect" ;
6768 await dialog . showMessageBox ( {
@@ -74,20 +75,21 @@ export function initNewServerForm({$root, onChange}: NewServerFormProps): void {
7475 } ) ;
7576 return ;
7677 }
78+
7779 await DomainUtil . addDomain ( serverConf ) ;
7880 onChange ( ) ;
7981 }
8082
81- autoComplete ( url : string ) : string {
82- const pattern = / ^ [ a - z A - Z \d - ] * $ / ;
83- let serverUrl = url . trim ( ) ;
83+ async function autoComplete ( url : string ) : Promise < string > {
84+ const pattern = / ^ [ a - z A - Z \d - ] * $ / ;
85+ let serverUrl = url . trim ( ) ;
8486
85- if ( pattern . test ( serverUrl ) ) {
86- serverUrl = ' https://' + serverUrl + ' .zulipchat.com' ;
87- }
87+ if ( pattern . test ( serverUrl ) ) {
88+ serverUrl = " https://" + serverUrl + " .zulipchat.com" ;
89+ }
8890
89- return serverUrl ;
90- }
91+ return serverUrl ;
92+ }
9193
9294 $saveServerButton . addEventListener ( "click" , async ( ) => {
9395 await submitFormHandler ( ) ;
0 commit comments