From fc0bcb3f455544e584c7faefce0e92baca3f6cee Mon Sep 17 00:00:00 2001 From: Jaco Date: Sun, 24 Oct 2021 14:54:15 +0200 Subject: [PATCH] Adjust address filter, always apply (#6392) * Adjust address filter, always apply * Adjust * Adjust --- .../react-components/src/util/checkVisibility.tsx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/react-components/src/util/checkVisibility.tsx b/packages/react-components/src/util/checkVisibility.tsx index c29c1f81ce..3d804b7ae2 100644 --- a/packages/react-components/src/util/checkVisibility.tsx +++ b/packages/react-components/src/util/checkVisibility.tsx @@ -14,13 +14,16 @@ export function checkVisibility (api: ApiPromise, address: string, accountInfo: if (filterLower || onlyNamed) { if (accountInfo) { const { accountId, accountIndex, identity, nickname } = accountInfo; + const hasAddressMatch = (!!accountId && accountId.toString().includes(filterName)) || (!!accountIndex && accountIndex.toString().includes(filterName)); - if (!onlyNamed && (accountId?.toString().includes(filterName) || accountIndex?.toString().includes(filterName))) { + if (!onlyNamed && hasAddressMatch) { isVisible = true; } else if (isFunction(api.query.identity?.identityOf)) { - isVisible = - (!!identity?.display && identity.display.toLowerCase().includes(filterLower)) || - (!!identity?.displayParent && identity.displayParent.toLowerCase().includes(filterLower)); + isVisible = !!identity && (!!identity.display || !!identity.displayParent) && ( + hasAddressMatch || + (!!identity.display && identity.display.toLowerCase().includes(filterLower)) || + (!!identity.displayParent && identity.displayParent.toLowerCase().includes(filterLower)) + ); } else if (nickname) { isVisible = nickname.toLowerCase().includes(filterLower); }