Lookup did for my profile at screen to avoid bad actor error (#1800)

zio/stable
Paul Frazee 2023-11-02 19:54:43 -07:00 committed by GitHub
parent 8747c215b1
commit 846c130706
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View File

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

View File

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