-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
check currentUser with accountID #29090
Conversation
@@ -121,7 +121,7 @@ function ProfilePage(props) { | |||
const phoneNumber = getPhoneNumber(details); | |||
const phoneOrEmail = isSMSLogin ? getPhoneNumber(details) : login; | |||
|
|||
const isCurrentUser = _.keys(props.loginList).includes(login); |
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.
src/pages/ProfilePage.js
Outdated
isLoadingReportData: { | ||
key: ONYXKEYS.IS_LOADING_REPORT_DATA, | ||
}, | ||
session: { |
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.
Add session to props
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.
Thank you. Done. Apologies for missing basic things in haste.
@@ -121,7 +114,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 comment
The reason will be displayed to describe this comment to others. Learn more.
Use this same fix for <DetailsPage />
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.
Done but the route param is email so the comparison is done with session.email.
src/pages/DetailsPage.js
Outdated
@@ -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(); |
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.
We should use the account id.
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.
But we can get accountID here only by checking corresponding login in personal details. Here we get only login from URL.
When we login with deeplink, personal details are not loaded immediately so account id is undefined and the check returns false even for same current user and the message button appears briefly.
Not related to this discussion but I made a mistake with the commit name for details Page.
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.
Hmm in that case please revert. We can't compare with session.email because one account can have multiple emails.
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.
Got it. I missed that.
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.
Or wait, currently we are comparing details.login from onyx and not login from route params. So if we just use details.accountID then we won't be introducing a new change (in terms of deep link behavior)
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.
Yea but that does not help in fixing this bug either.
If we get directly from URL then we can get the current user check instantly. But like you said, the primary login may be different so session.email === email from url does not work.
Changing to accountID also has no use in this case. Loginlist and personaldetails are loaded more or less at the same time.
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.
I understand that the change to DetailsPage will fix nothing. but also will break nothing right? I'm suggesting this just for consistency i.e. to have the isCurrentUser always related to the account id
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.
Got it. I will make that change.
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.
Done
Reviewer Checklist
Screenshots/VideosWebweb.movMobile Web - Chromemweb-chrome.movMobile Web - Safarimweb-safari.movDesktopdesktop.mov |
Hmm, we got some conflicts 😢 |
f2304f9
to
c01b4be
Compare
@c3024 Still more conflicts 😅 |
No more merge conflicts!! |
Retested. Still working as expected |
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to production by https://github.com/jasperhuangg in version: 1.3.83-11 🚀
|
🚀 Deployed to production by https://github.com/jasperhuangg in version: 1.3.83-11 🚀
|
1 similar comment
🚀 Deployed to production by https://github.com/jasperhuangg in version: 1.3.83-11 🚀
|
🚀 Deployed to production by https://github.com/jasperhuangg in version: 1.3.83-11 🚀
|
Details
Fixed Issues
$ #28591
PROPOSAL: #28591 (comment)
Tests
Offline tests
NA
QA Steps
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Web
web9.mov
Mobile Web - Chrome
mWeb9.mp4
Mobile Web - Safari
safari9.mov
Desktop
desktop9.mov
iOS
iOS9.mov
Android
androidNative.mov