Commit 469f7997 authored by tom goriunov's avatar tom goriunov Committed by GitHub

Invalid case-sensitive comparison in AddressFromTo (#2719)

Fixes #2688
parent 6aa1b99e
...@@ -36,6 +36,8 @@ const AddressFromTo = ({ from, to, current, mode: modeProp, className, isLoading ...@@ -36,6 +36,8 @@ const AddressFromTo = ({ from, to, current, mode: modeProp, className, isLoading
) ?? 'long'; ) ?? 'long';
const Entity = tokenHash && tokenSymbol ? AddressEntityWithTokenFilter : AddressEntity; const Entity = tokenHash && tokenSymbol ? AddressEntityWithTokenFilter : AddressEntity;
const isOutgoing = current ? current.toLowerCase() === from.hash.toLowerCase() : false;
const isIncoming = current ? current.toLowerCase() === to?.hash?.toLowerCase() : false;
if (mode === 'compact') { if (mode === 'compact') {
return ( return (
...@@ -49,8 +51,8 @@ const AddressFromTo = ({ from, to, current, mode: modeProp, className, isLoading ...@@ -49,8 +51,8 @@ const AddressFromTo = ({ from, to, current, mode: modeProp, className, isLoading
<Entity <Entity
address={ from } address={ from }
isLoading={ isLoading } isLoading={ isLoading }
noLink={ current === from.hash } noLink={ isOutgoing }
noCopy={ current === from.hash } noCopy={ isOutgoing }
noIcon={ noIcon } noIcon={ noIcon }
tokenHash={ tokenHash } tokenHash={ tokenHash }
tokenSymbol={ tokenSymbol } tokenSymbol={ tokenSymbol }
...@@ -63,8 +65,8 @@ const AddressFromTo = ({ from, to, current, mode: modeProp, className, isLoading ...@@ -63,8 +65,8 @@ const AddressFromTo = ({ from, to, current, mode: modeProp, className, isLoading
<Entity <Entity
address={ to } address={ to }
isLoading={ isLoading } isLoading={ isLoading }
noLink={ current === to.hash } noLink={ isIncoming }
noCopy={ current === to.hash } noCopy={ isIncoming }
noIcon={ noIcon } noIcon={ noIcon }
tokenHash={ tokenHash } tokenHash={ tokenHash }
tokenSymbol={ tokenSymbol } tokenSymbol={ tokenSymbol }
...@@ -78,7 +80,6 @@ const AddressFromTo = ({ from, to, current, mode: modeProp, className, isLoading ...@@ -78,7 +80,6 @@ const AddressFromTo = ({ from, to, current, mode: modeProp, className, isLoading
); );
} }
const isOutgoing = current === from.hash;
const iconSize = 20; const iconSize = 20;
return ( return (
...@@ -102,8 +103,8 @@ const AddressFromTo = ({ from, to, current, mode: modeProp, className, isLoading ...@@ -102,8 +103,8 @@ const AddressFromTo = ({ from, to, current, mode: modeProp, className, isLoading
<Entity <Entity
address={ to } address={ to }
isLoading={ isLoading } isLoading={ isLoading }
noLink={ current === to.hash } noLink={ isIncoming }
noCopy={ current === to.hash } noCopy={ isIncoming }
noIcon={ noIcon } noIcon={ noIcon }
tokenHash={ tokenHash } tokenHash={ tokenHash }
tokenSymbol={ tokenSymbol } tokenSymbol={ tokenSymbol }
......
...@@ -7,15 +7,19 @@ export function getTxCourseType(from: string, to: string | undefined, current?: ...@@ -7,15 +7,19 @@ export function getTxCourseType(from: string, to: string | undefined, current?:
return 'unspecified'; return 'unspecified';
} }
if (to && from === to && from === current) { const fromLower = from.toLowerCase();
const toLower = to?.toLowerCase();
const currentLower = current.toLowerCase();
if (toLower && fromLower === toLower && fromLower === currentLower) {
return 'self'; return 'self';
} }
if (from === current) { if (fromLower === currentLower) {
return 'out'; return 'out';
} }
if (to && to === current) { if (toLower && toLower === currentLower) {
return 'in'; return 'in';
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment