-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
check currentUser with accountID #29090
Changes from 5 commits
fe2d0e1
fa2f65a
d5506c9
402548b
c01b4be
e36290b
525c50e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,23 +57,25 @@ const propTypes = { | |
/** Route params */ | ||
route: matchType.isRequired, | ||
|
||
/** Login list for the user that is signed in */ | ||
loginList: PropTypes.shape({ | ||
/** Phone/Email associated with user */ | ||
partnerUserID: PropTypes.string, | ||
}), | ||
|
||
/** Indicates whether the app is loading initial data */ | ||
isLoadingReportData: PropTypes.bool, | ||
|
||
/** Session info for the currently logged in user. */ | ||
session: PropTypes.shape({ | ||
/** Currently logged in user accountID */ | ||
accountID: PropTypes.number, | ||
}), | ||
|
||
...withLocalizePropTypes, | ||
}; | ||
|
||
const defaultProps = { | ||
// When opening someone else's profile (via deep link) before login, this is empty | ||
personalDetails: {}, | ||
loginList: {}, | ||
isLoadingReportData: true, | ||
session: { | ||
accountID: 0, | ||
}, | ||
}; | ||
|
||
/** | ||
|
@@ -121,7 +123,7 @@ function ProfilePage(props) { | |
const phoneNumber = getPhoneNumber(details); | ||
const phoneOrEmail = isSMSLogin ? getPhoneNumber(details) : login; | ||
|
||
const isCurrentUser = _.keys(props.loginList).includes(login); | ||
const isCurrentUser = props.session.accountID === accountID; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use this same fix for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done but the route param is email so the comparison is done with session.email. |
||
const hasMinimumDetails = !_.isEmpty(details.avatar) && !_.isUndefined(details.displayName); | ||
const isLoading = lodashGet(details, 'isLoading', false) || _.isEmpty(details) || props.isLoadingReportData; | ||
|
||
|
@@ -280,12 +282,12 @@ export default compose( | |
personalDetails: { | ||
key: ONYXKEYS.PERSONAL_DETAILS_LIST, | ||
}, | ||
loginList: { | ||
key: ONYXKEYS.LOGIN_LIST, | ||
}, | ||
isLoadingReportData: { | ||
key: ONYXKEYS.IS_LOADING_REPORT_DATA, | ||
}, | ||
session: { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add session to props There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you. Done. Apologies for missing basic things in haste. |
||
key: ONYXKEYS.SESSION, | ||
}, | ||
betas: { | ||
key: ONYXKEYS.BETAS, | ||
}, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If loginList is not used anywhere remove it from onyx subscription
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Done.