From fe2d0e19bfe1855932b2c53fe2d9a263a62324e3 Mon Sep 17 00:00:00 2001 From: c3024 Date: Mon, 9 Oct 2023 19:11:27 +0530 Subject: [PATCH 1/6] check currentUser with accountID --- src/pages/ProfilePage.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pages/ProfilePage.js b/src/pages/ProfilePage.js index 6bacc8ed3bb4..dfe1ff10e59c 100755 --- a/src/pages/ProfilePage.js +++ b/src/pages/ProfilePage.js @@ -121,7 +121,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; const hasMinimumDetails = !_.isEmpty(details.avatar) && !_.isUndefined(details.displayName); const isLoading = lodashGet(details, 'isLoading', false) || _.isEmpty(details) || props.isLoadingReportData; @@ -286,6 +286,9 @@ export default compose( isLoadingReportData: { key: ONYXKEYS.IS_LOADING_REPORT_DATA, }, + session: { + key: ONYXKEYS.SESSION, + }, betas: { key: ONYXKEYS.BETAS, }, From fa2f65a05e5e1ca6b73515630ea7fd6a9dce145e Mon Sep 17 00:00:00 2001 From: c3024 Date: Mon, 9 Oct 2023 19:52:57 +0530 Subject: [PATCH 2/6] remove loginList --- src/pages/ProfilePage.js | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/pages/ProfilePage.js b/src/pages/ProfilePage.js index dfe1ff10e59c..7e41a8f5df8c 100755 --- a/src/pages/ProfilePage.js +++ b/src/pages/ProfilePage.js @@ -57,12 +57,6 @@ 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, @@ -72,7 +66,6 @@ const propTypes = { const defaultProps = { // When opening someone else's profile (via deep link) before login, this is empty personalDetails: {}, - loginList: {}, isLoadingReportData: true, }; @@ -280,9 +273,6 @@ export default compose( personalDetails: { key: ONYXKEYS.PERSONAL_DETAILS_LIST, }, - loginList: { - key: ONYXKEYS.LOGIN_LIST, - }, isLoadingReportData: { key: ONYXKEYS.IS_LOADING_REPORT_DATA, }, From d5506c92420786d2a198cfd4de73e369a2312e79 Mon Sep 17 00:00:00 2001 From: c3024 Date: Mon, 9 Oct 2023 21:10:45 +0530 Subject: [PATCH 3/6] add session to default props and propTypes --- src/pages/ProfilePage.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/pages/ProfilePage.js b/src/pages/ProfilePage.js index 7e41a8f5df8c..97fd09e0c742 100755 --- a/src/pages/ProfilePage.js +++ b/src/pages/ProfilePage.js @@ -60,6 +60,12 @@ const propTypes = { /** 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, }; @@ -67,6 +73,9 @@ const defaultProps = { // When opening someone else's profile (via deep link) before login, this is empty personalDetails: {}, isLoadingReportData: true, + session: { + accountID: 0, + }, }; /** From 402548b38f8519840b332bb88be9dcebf47ea7fb Mon Sep 17 00:00:00 2001 From: c3024 Date: Mon, 9 Oct 2023 21:20:39 +0530 Subject: [PATCH 4/6] check current user with accountID in DetailsPage --- src/pages/DetailsPage.js | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/pages/DetailsPage.js b/src/pages/DetailsPage.js index 2f8d42c686a9..967268e91dfb 100755 --- a/src/pages/DetailsPage.js +++ b/src/pages/DetailsPage.js @@ -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, @@ -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: '', + }, }; /** @@ -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 ( @@ -225,8 +224,8 @@ export default compose( personalDetails: { key: ONYXKEYS.PERSONAL_DETAILS_LIST, }, - loginList: { - key: ONYXKEYS.LOGIN_LIST, + session: { + key: ONYXKEYS.SESSION, }, }), )(DetailsPage); From c01b4be63fc1360bfc52ffbd3cc2e03b1a4d43f8 Mon Sep 17 00:00:00 2001 From: c3024 Date: Tue, 10 Oct 2023 00:13:05 +0530 Subject: [PATCH 5/6] check currentUser with accountID in DetailsPage --- src/pages/DetailsPage.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pages/DetailsPage.js b/src/pages/DetailsPage.js index 967268e91dfb..e4a1b763cd62 100755 --- a/src/pages/DetailsPage.js +++ b/src/pages/DetailsPage.js @@ -50,8 +50,8 @@ const propTypes = { /** Session info for the currently logged in user. */ session: PropTypes.shape({ - /** Currently logged in user email */ - email: PropTypes.string, + /** Currently logged in user accountID */ + accountID: PropTypes.number, }), ...withLocalizePropTypes, @@ -61,7 +61,7 @@ const defaultProps = { // When opening someone else's profile (via deep link) before login, this is empty personalDetails: {}, session: { - email: '', + accountID: 0, }, }; @@ -122,7 +122,7 @@ function DetailsPage(props) { const phoneNumber = getPhoneNumber(details); const phoneOrEmail = isSMSLogin ? getPhoneNumber(details) : details.login; - const isCurrentUser = props.session.email === login.toLowerCase(); + const isCurrentUser = props.session.accountID === details.accountID; return ( From 525c50e42c2fecc94084da1b536b804ff4ad6dbe Mon Sep 17 00:00:00 2001 From: c3024 Date: Tue, 10 Oct 2023 20:37:56 +0530 Subject: [PATCH 6/6] fix merge conflicts --- src/pages/ProfilePage.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/pages/ProfilePage.js b/src/pages/ProfilePage.js index 502334c217ce..5e1157a29e0d 100755 --- a/src/pages/ProfilePage.js +++ b/src/pages/ProfilePage.js @@ -295,9 +295,6 @@ export default compose( isLoadingReportData: { key: ONYXKEYS.IS_LOADING_REPORT_DATA, }, - session: { - key: ONYXKEYS.SESSION, - }, betas: { key: ONYXKEYS.BETAS, },