Page MenuHomePhabricator

D10259.id34432.diff
No OneTemporary

D10259.id34432.diff

diff --git a/native/user-profile/user-profile.react.js b/native/user-profile/user-profile.react.js
--- a/native/user-profile/user-profile.react.js
+++ b/native/user-profile/user-profile.react.js
@@ -6,6 +6,7 @@
import { View, Text, TouchableOpacity } from 'react-native';
import { useSafeAreaInsets } from 'react-native-safe-area-context';
+import { useENSName } from 'lib/hooks/ens-cache.js';
import { relationshipBlockedInEitherDirection } from 'lib/shared/relationship-utils.js';
import { useUserProfileThreadInfo } from 'lib/shared/thread-utils.js';
import { stringForUserExplicit } from 'lib/shared/user-utils.js';
@@ -37,6 +38,7 @@
const userProfileThreadInfo = useUserProfileThreadInfo(userInfo);
const usernameText = stringForUserExplicit(userInfo);
+ const resolvedUsernameText = useENSName(usernameText);
const [usernameCopied, setUsernameCopied] = React.useState<boolean>(false);
@@ -97,11 +99,11 @@
}, [userProfileThreadInfo]);
const onPressCopyUsername = React.useCallback(async () => {
- Clipboard.setString(usernameText);
+ Clipboard.setString(resolvedUsernameText);
setUsernameCopied(true);
await sleep(3000);
setUsernameCopied(false);
- }, [usernameText]);
+ }, [resolvedUsernameText]);
const copyUsernameButton = React.useMemo(() => {
if (usernameCopied) {
@@ -177,7 +179,9 @@
<View style={styles.userInfoContainer}>
<UserProfileAvatar userID={userInfo?.id} />
<View style={styles.usernameContainer}>
- <SingleLine style={styles.usernameText}>{usernameText}</SingleLine>
+ <SingleLine style={styles.usernameText}>
+ {resolvedUsernameText}
+ </SingleLine>
{copyUsernameButton}
</View>
</View>
diff --git a/web/modals/user-profile/user-profile.react.js b/web/modals/user-profile/user-profile.react.js
--- a/web/modals/user-profile/user-profile.react.js
+++ b/web/modals/user-profile/user-profile.react.js
@@ -4,6 +4,7 @@
import { useModalContext } from 'lib/components/modal-provider.react.js';
import SWMansionIcon from 'lib/components/SWMansionIcon.react.js';
+import { useENSName } from 'lib/hooks/ens-cache.js';
import { relationshipBlockedInEitherDirection } from 'lib/shared/relationship-utils.js';
import { stringForUserExplicit } from 'lib/shared/user-utils.js';
import type { UserProfileThreadInfo } from 'lib/types/thread-types';
@@ -27,6 +28,7 @@
const { pushModal } = useModalContext();
const usernameText = stringForUserExplicit(userInfo);
+ const resolvedUsernameText = useENSName(usernameText);
const [usernameCopied, setUsernameCopied] = React.useState<boolean>(false);
@@ -39,11 +41,11 @@
return;
}
- await navigator.clipboard.writeText(usernameText);
+ await navigator.clipboard.writeText(resolvedUsernameText);
setUsernameCopied(true);
await sleep(3000);
setUsernameCopied(false);
- }, [usernameCopied, usernameText]);
+ }, [usernameCopied, resolvedUsernameText]);
const actionButtons = React.useMemo(() => {
if (
@@ -66,7 +68,9 @@
<UserAvatar userID={userInfo?.id} size="L" />
</div>
<div className={css.usernameContainer}>
- <SingleLine className={css.usernameText}>{usernameText}</SingleLine>
+ <SingleLine className={css.usernameText}>
+ {resolvedUsernameText}
+ </SingleLine>
<div
className={css.copyUsernameContainer}
onClick={onClickCopyUsername}
@@ -90,7 +94,7 @@
onClickUserAvatar,
userInfo?.id,
usernameCopied,
- usernameText,
+ resolvedUsernameText,
],
);

File Metadata

Mime Type
text/plain
Expires
Sat, Dec 21, 9:44 PM (20 h, 28 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2688817
Default Alt Text
D10259.id34432.diff (3 KB)

Event Timeline