fix(@desktop/profile): handle empty text in add contact properly

fixes #3046

also fix the fact that the query is only triggered when the text is changed
vs when pressing any key
This commit is contained in:
Anthony Laibe 2021-07-29 11:54:00 +02:00 committed by Iuri Matias
parent 9893dbb00c
commit b3ea8f9502
1 changed files with 11 additions and 11 deletions

View File

@ -159,18 +159,18 @@ Item {
placeholderText: qsTrId("enter-contact-code")
customHeight: 44
fontPixelSize: 15
Keys.onReleased: {
if (text !== "") {
if (!addContactModal.validate(addContactSearchInput.text)) {
searchResults.reset();
contactsContainer.isPending = false;
return;
}
Qt.callLater(addContactModal.lookupContact, addContactSearchInput.text);
} else {
addContactModal.validationError = "";
onTextEdited: {
if (addContactSearchInput.text === "") {
searchResults.reset();
return;
}
if (!addContactModal.validate(addContactSearchInput.text)) {
searchResults.reset();
contactsContainer.isPending = false;
return;
}
Qt.callLater(addContactModal.lookupContact, addContactSearchInput.text);
}