about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorPaul Frazee <pfrazee@gmail.com>2023-11-02 19:54:43 -0700
committerGitHub <noreply@github.com>2023-11-02 19:54:43 -0700
commit846c13070673bca2f0e14751aa8fdb7322fb8ed9 (patch)
treebd19f2695dd6f0211220e169575d7954ecbb72c3 /src
parent8747c215b1735e9074fbfd43003d72793498e125 (diff)
downloadvoidsky-846c13070673bca2f0e14751aa8fdb7322fb8ed9.tar.zst
Lookup did for my profile at screen to avoid bad actor error (#1800)
Diffstat (limited to 'src')
-rw-r--r--src/Navigation.tsx3
-rw-r--r--src/view/screens/Profile.tsx7
2 files changed, 5 insertions, 5 deletions
diff --git a/src/Navigation.tsx b/src/Navigation.tsx
index 49a2c429d..a6949de23 100644
--- a/src/Navigation.tsx
+++ b/src/Navigation.tsx
@@ -349,7 +349,6 @@ function NotificationsTabNavigator() {
 
 const MyProfileTabNavigator = observer(function MyProfileTabNavigatorImpl() {
   const contentStyle = useColorSchemeStyle(styles.bgLight, styles.bgDark)
-  const store = useStores()
   return (
     <MyProfileTab.Navigator
       screenOptions={{
@@ -364,7 +363,7 @@ const MyProfileTabNavigator = observer(function MyProfileTabNavigatorImpl() {
         // @ts-ignore // TODO: fix this broken type in ProfileScreen
         getComponent={() => ProfileScreen}
         initialParams={{
-          name: store.me.did,
+          name: 'me',
         }}
       />
       {commonScreens(MyProfileTab as typeof HomeTab)}
diff --git a/src/view/screens/Profile.tsx b/src/view/screens/Profile.tsx
index c1ab69313..6c5a84e83 100644
--- a/src/view/screens/Profile.tsx
+++ b/src/view/screens/Profile.tsx
@@ -36,6 +36,7 @@ export const ProfileScreen = withAuthRequired(
     const store = useStores()
     const {screen, track} = useAnalytics()
     const viewSelectorRef = React.useRef<ViewSelectorHandle>(null)
+    const name = route.params.name === 'me' ? store.me.did : route.params.name
 
     useEffect(() => {
       screen('Profile')
@@ -43,8 +44,8 @@ export const ProfileScreen = withAuthRequired(
 
     const [hasSetup, setHasSetup] = useState<boolean>(false)
     const uiState = React.useMemo(
-      () => new ProfileUiModel(store, {user: route.params.name}),
-      [route.params.name, store],
+      () => new ProfileUiModel(store, {user: name}),
+      [name, store],
     )
     useSetTitle(combinedDisplayName(uiState.profile))
 
@@ -54,7 +55,7 @@ export const ProfileScreen = withAuthRequired(
 
     useEffect(() => {
       setHasSetup(false)
-    }, [route.params.name])
+    }, [name])
 
     // We don't need this to be reactive, so we can just register the listeners once
     useEffect(() => {