Adjust address filter, always apply (#6392)

* Adjust address filter, always apply

* Adjust

* Adjust
This commit is contained in:
Jaco 2021-10-24 14:54:15 +02:00 committed by GitHub
parent b47cb9c942
commit fc0bcb3f45
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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);
}