mirror of
https://github.com/irislib/iris-messenger.git
synced 2024-10-18 06:03:22 +00:00
more chat fixes
This commit is contained in:
parent
8fbde57db0
commit
b97db6ab58
@ -10,7 +10,7 @@ import Show from '../helpers/Show';
|
||||
import ProxyImg from '../ProxyImg.tsx';
|
||||
|
||||
type Props = {
|
||||
str: unknown;
|
||||
str: string;
|
||||
hidePicture?: boolean;
|
||||
showTooltip?: boolean;
|
||||
activity?: string;
|
||||
@ -23,7 +23,10 @@ const MyAvatar: React.FC<Props> = (props) => {
|
||||
const [avatar, setAvatar] = useState<string | null>(null);
|
||||
const [hasError, setHasError] = useState<boolean>(false);
|
||||
|
||||
const hex = React.useMemo(() => Key.toNostrHexAddress(props.str as string), [props.str]);
|
||||
const hex = React.useMemo(
|
||||
() => Key.toNostrHexAddress(props.str as string) || props.str,
|
||||
[props.str],
|
||||
);
|
||||
|
||||
const { picture, name } = useProfile(hex || '');
|
||||
|
||||
|
@ -242,7 +242,12 @@ export default {
|
||||
|
||||
try {
|
||||
const hex = new Hex(address);
|
||||
return hex.toBech32(prefix);
|
||||
const bech32 = hex.toBech32(prefix);
|
||||
if (bech32.length < 60) {
|
||||
// not a nostr key
|
||||
return null;
|
||||
}
|
||||
return bech32;
|
||||
} catch (e) {
|
||||
// not a valid hex
|
||||
console.error(address, e);
|
||||
|
Loading…
Reference in New Issue
Block a user