Skip to content

Commit

Permalink
Lookup did for my profile at screen to avoid bad actor error (#1800)
Browse files Browse the repository at this point in the history
  • Loading branch information
pfrazee authored Nov 3, 2023
1 parent 8747c21 commit 846c130
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
3 changes: 1 addition & 2 deletions src/Navigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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={{
Expand All @@ -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)}
Expand Down
7 changes: 4 additions & 3 deletions src/view/screens/Profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,16 @@ 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')
}, [screen])

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))

Expand All @@ -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(() => {
Expand Down

0 comments on commit 846c130

Please sign in to comment.