Always let the user try what they have entered, to get an explicit error if they continue

This commit is contained in:
Benoit Marty 2025-11-06 15:21:50 +01:00 committed by Benoit Marty
parent e3ed75d19e
commit a9958505d3
2 changed files with 11 additions and 4 deletions

View file

@ -52,9 +52,10 @@ class HomeserverResolver(
}
}
}
// If list is empty, and the user has entered an URL, do not block the user.
if (currentList.isEmpty() && trimmedUserInput.isValidUrl()) {
emit(listOf(HomeserverData(homeserverUrl = trimmedUserInput)))
// If list is empty, and candidateBase is a valid an URL, do not block the user.
// A unsupported homeserver / homeserver not found error will be displayed if the user continues
if (currentList.isEmpty() && candidateBase.isValidUrl()) {
emit(listOf(HomeserverData(homeserverUrl = candidateBase)))
}
}

View file

@ -85,7 +85,13 @@ class SearchAccountProviderPresenterTest {
assertThat(withInputState.userInput).isEqualTo("test")
assertThat(initialState.userInputResult).isEqualTo(AsyncData.Uninitialized)
assertThat(awaitItem().userInputResult).isInstanceOf(AsyncData.Loading::class.java)
assertThat(awaitItem().userInputResult).isEqualTo(AsyncData.Uninitialized)
assertThat(awaitItem().userInputResult).isEqualTo(
AsyncData.Success(
listOf(
aHomeserverData(homeserverUrl = "https://test"),
)
)
)
}
}