Skip to content

Commit

Permalink
check current user with accountID in DetailsPage
Browse files Browse the repository at this point in the history
  • Loading branch information
c3024 committed Oct 9, 2023
1 parent d5506c9 commit 402548b
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions src/pages/DetailsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,10 @@ const propTypes = {
/** Route params */
route: matchType.isRequired,

/** Login list for the user that is signed in */
loginList: PropTypes.shape({
/** Date login was validated, used to show info indicator status */
validatedDate: PropTypes.string,

/** Field-specific server side errors keyed by microtime */
errorFields: PropTypes.objectOf(PropTypes.objectOf(PropTypes.string)),
/** Session info for the currently logged in user. */
session: PropTypes.shape({
/** Currently logged in user email */
email: PropTypes.string,
}),

...withLocalizePropTypes,
Expand All @@ -63,7 +60,9 @@ const propTypes = {
const defaultProps = {
// When opening someone else's profile (via deep link) before login, this is empty
personalDetails: {},
loginList: {},
session: {
email: '',
},
};

/**
Expand Down Expand Up @@ -123,7 +122,7 @@ function DetailsPage(props) {
const phoneNumber = getPhoneNumber(details);
const phoneOrEmail = isSMSLogin ? getPhoneNumber(details) : details.login;

const isCurrentUser = _.keys(props.loginList).includes(details.login);
const isCurrentUser = props.session.email === login.toLowerCase();

return (
<ScreenWrapper testID={DetailsPage.displayName}>
Expand Down Expand Up @@ -225,8 +224,8 @@ export default compose(
personalDetails: {
key: ONYXKEYS.PERSONAL_DETAILS_LIST,
},
loginList: {
key: ONYXKEYS.LOGIN_LIST,
session: {
key: ONYXKEYS.SESSION,
},
}),
)(DetailsPage);

0 comments on commit 402548b

Please sign in to comment.