From 29add2fbc907a983e97c0c864ae763fcaebc0eae Mon Sep 17 00:00:00 2001 From: Patryk Osmaczko Date: Wed, 17 Aug 2022 08:44:02 +0200 Subject: [PATCH] chore(settings/messaging): improve contact filter expressions --- ui/app/AppLayouts/Profile/panels/ContactsListPanel.qml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/ui/app/AppLayouts/Profile/panels/ContactsListPanel.qml b/ui/app/AppLayouts/Profile/panels/ContactsListPanel.qml index 0d9b933658..b75b7e16d4 100644 --- a/ui/app/AppLayouts/Profile/panels/ContactsListPanel.qml +++ b/ui/app/AppLayouts/Profile/panels/ContactsListPanel.qml @@ -68,10 +68,8 @@ Item { } function searchPredicate(name, pubkey) { - if (root.searchString === "") return true - - let lowerCaseSearchString = root.searchString.toLowerCase() - let compressedPubkey = Utils.getCompressedPk(pubkey) + const lowerCaseSearchString = root.searchString.toLowerCase() + const compressedPubkey = Utils.getCompressedPk(pubkey) return name.toLowerCase().includes(lowerCaseSearchString) || pubkey.toLowerCase().includes(lowerCaseSearchString) || @@ -81,9 +79,10 @@ Item { filters: [ ExpressionFilter { expression: filteredModel.panelUsagePredicate(model.isVerified) }, ExpressionFilter { + enabled: root.searchString !== "" expression: { root.searchString // ensure expression is reevaluated when searchString changes - filteredModel.searchPredicate(model.displayName, model.pubKey) + return filteredModel.searchPredicate(model.displayName, model.pubKey) } } ]