Skip to content
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

Update timezone correctly in the personal details #13574

Merged
merged 1 commit into from
Dec 14, 2022

Conversation

aldo-expensify
Copy link
Contributor

@aldo-expensify aldo-expensify commented Dec 14, 2022

Details

In ONYXKEYS.PERSONAL_DETAILS we store an object like:

{
    "someemail@domain.com": {
        "avatar": "...",
        "displayName": "someemail@domain.com",
        "firstName": "",
        "lastName": "",
        "localCurrencyCode": "USD",
        "login": "someemail@domain.com",
        "payPalMeAddress": "",
        "phoneNumber": "",
        "pronouns": "",
        "timezone": {
            "automatic": false,
            "selected": "Africa/Asmara"
        },
        "validated": true
    },
    "someemail2@domain2.com": {...},
    "someemail3@domain3.com": {...},
}

The merged value{[currentUserEmail]: timezone} is wrong because it ends up merging the timezone into the personal details instead of the personal details' timezone. This results in:

image

Fixed Issues

Part of #13223 (comment)

Tests

  1. Login into new dot
  2. Wait 5 minutes (or modify your code so DateUtils.canUpdateTimezone always returns true)
  3. (Only in web): Open chrome dev tools, network tab
  4. Send a message to someone
  5. (Only in web): Find the request api?command=AddComment and verify that in the payload the timezone is being sent
  6. Check that your personalDetails in Onyx don't contain the timezone keys automatic and selected
  • Verify that no errors appear in the JS console

Offline tests

QA Steps

  1. Login into new dot
  2. Wait 5 minutes
  3. Send a message to someone
  4. Check that your personalDetails in Onyx don't contain the timezone keys automatic and selected
  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • iOS / native
    • Android / native
    • iOS / Safari
    • Android / Chrome
    • MacOS / Chrome
    • MacOS / Desktop
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is correct English and approved by marketing by adding the Waiting for Copy label for a copy review on the original GH to get the correct copy.
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • I have checked off every checkbox in the PR author checklist, including those that don't apply to this PR.

Screenshots/Videos

Web
Screen.Recording.2022-12-13.at.4.19.14.PM.mov
Mobile Web - Chrome
Screen.Recording.2022-12-14.at.10.08.56.AM.mov
Mobile Web - Safari
Screen.Recording.2022-12-14.at.10.14.30.AM.mov
Desktop
Screen.Recording.2022-12-14.at.10.03.32.AM.mov
iOS

N/A

Android

N/A

@aldo-expensify aldo-expensify self-assigned this Dec 14, 2022
@melvin-bot
Copy link

melvin-bot bot commented Dec 14, 2022

❗ Please, do not use Github auto-linking keywords such as these: close, closes, closed, fix, fixes, fixed, resolve, resolves or resolved.

For more details, see the Contributing Guidelines, specifically Submit your pull request for a final review 📖.

1 similar comment
@melvin-bot
Copy link

melvin-bot bot commented Dec 14, 2022

❗ Please, do not use Github auto-linking keywords such as these: close, closes, closed, fix, fixes, fixed, resolve, resolves or resolved.

For more details, see the Contributing Guidelines, specifically Submit your pull request for a final review 📖.

@melvin-bot
Copy link

melvin-bot bot commented Dec 14, 2022

❗ Please, do not use Github auto-linking keywords such as these: close, closes, closed, fix, fixes, fixed, resolve, resolves or resolved.

For more details, see the Contributing Guidelines, specifically Submit your pull request for a final review 📖.

@aldo-expensify aldo-expensify marked this pull request as ready for review December 14, 2022 00:20
@aldo-expensify aldo-expensify requested a review from a team as a code owner December 14, 2022 00:20
@melvin-bot melvin-bot bot requested review from nkuoch and removed request for a team December 14, 2022 00:21
@melvin-bot
Copy link

melvin-bot bot commented Dec 14, 2022

@nkuoch Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@aldo-expensify
Copy link
Contributor Author

I only took a video in web because it is easy to see there the AddComment request and confirm that the personal details in Onyx are still fine.

I'm not sure how to show this in a useful way in the other platforms.

@nkuoch
Copy link
Contributor

nkuoch commented Dec 14, 2022

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified tests pass on all platforms & I tested again on:
    • iOS / native
    • Android / native
    • iOS / Safari
    • Android / Chrome
    • MacOS / Chrome
    • MacOS / Desktop
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified proper code patterns were followed (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick).
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is correct English and approved by marketing by adding the Waiting for Copy label for a copy review on the original GH to get the correct copy.
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Web
web.mov
Mobile Web - Chrome
mweb-chrome.mov
Mobile Web - Safari
mweb-safari.mov
Desktop
desktop.mov
iOS

N/A

Android

N/A

@nkuoch
Copy link
Contributor

nkuoch commented Dec 14, 2022

I believe under Fixed Issues you should use $ instead if fixes

@amyevans
Copy link
Contributor

I believe under Fixed Issues you should use $ instead if fixes

I think it should actually be neither since we don't want the deploy of this PR to auto-close that issue.

@amyevans
Copy link
Contributor

@nkuoch Let me know if you want a hand with the remainder of the checklist!

@nkuoch
Copy link
Contributor

nkuoch commented Dec 14, 2022

If we don't want to close the original issue, then yes, neither. Something like "Part of ..."

@nkuoch
Copy link
Contributor

nkuoch commented Dec 14, 2022

@amyevans yes, would love if you could do the testing, thanks so much

@amyevans
Copy link
Contributor

I found a way to access the inspector for the first 4 platforms so I added videos from testing on those and completed the checklist. Flipper has been broken for some time though, so I was unable to do iOS and Android native.

Copy link
Contributor

@amyevans amyevans left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm the PR reviewer checklist check is still failing, I tried re-running the job, but that didn't fix it.

@amyevans
Copy link
Contributor

You completed 47 out of 50 checklist items with 0 unfinished items

Hmm

@amyevans
Copy link
Contributor

amyevans commented Dec 14, 2022

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified tests pass on all platforms & I tested again on:
    • iOS / native
    • Android / native
    • iOS / Safari
    • Android / Chrome
    • MacOS / Chrome
    • MacOS / Desktop
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified proper code patterns were followed (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick).
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is correct English and approved by marketing by adding the Waiting for Copy label for a copy review on the original GH to get the correct copy.
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Web
web.mov
Mobile Web - Chrome
mweb-chrome.mov
Mobile Web - Safari
mweb-safari.mov
Desktop
desktop.mov
iOS

N/A

Android

N/A

@amyevans
Copy link
Contributor

Looks like the checklist was updated yesterday, so I'll fill out the newest checklist from main ^

@amyevans
Copy link
Contributor

Seems as though the script only evaluates the first checklist encountered, so I updated the original and now it's finally passing :lolsob:

I think we're all set here!

@amyevans
Copy link
Contributor

Wait, now we have

You completed 48 out of 51 checklist items with 0 unfinished items

on the Author Checklist

@aldo-expensify
Copy link
Contributor Author

I'll update the PR checklist

From your testing, I see that you can pull up the dev tools to see Onxy for IOS/Android mWeb and even for desktop. Thanks for doing that.

@aldo-expensify
Copy link
Contributor Author

Corrected the PR Author checklist and added video for mWeb and desktop.

@aldo-expensify aldo-expensify merged commit 163addf into main Dec 14, 2022
@aldo-expensify aldo-expensify deleted the aldo_fix-add-comment-timezone-onyx branch December 14, 2022 18:16
@OSBotify
Copy link
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@github-actions
Copy link
Contributor

Performance Comparison Report 📊

Significant Changes To Duration

There are no entries

Meaningless Changes To Duration

Show entries
Name Duration
runJsBundle 187.806 ms → 197.688 ms (+9.881 ms, +5.3%)
TTI 817.646 ms → 827.376 ms (+9.730 ms, +1.2%)
nativeLaunch 9.129 ms → 9.172 ms (+0.043 ms, ±0.0%)
regularAppStart 0.014 ms → 0.015 ms (+0.000 ms, +1.2%)
Show details
Name Duration
runJsBundle Baseline
Mean: 187.806 ms
Stdev: 19.636 ms (10.5%)
Runs: 157 163 163 166 167 168 170 170 171 172 174 176 176 178 178 184 187 188 198 200 200 202 204 204 205 212 213 214 217 218 227

Current
Mean: 197.688 ms
Stdev: 19.127 ms (9.7%)
Runs: 163 169 171 173 174 176 176 178 184 184 187 191 193 195 197 197 199 200 201 205 206 208 208 210 214 215 217 220 221 228 231 235
TTI Baseline
Mean: 817.646 ms
Stdev: 36.659 ms (4.5%)
Runs: 769.3931049997918 770.3639670000412 775.4443569998257 776.2602829998359 780.5703250002116 783.001745000016 784.6259269998409 789.8872130000964 790.0787030002102 793.1729609998874 793.5653349999338 795.601069000084 797.7304320000112 801.3940510000102 807.3770750002004 809.8787770001218 810.0223639998585 823.6393419997767 824.8380439998582 829.024960000068 830.5062230001204 832.0617709998041 840.5537129999138 842.1841489998624 843.9303850000724 855.391590999905 858.2446519997902 859.433523000218 863.6418860000558 894.7883850000799 920.4265560000204

Current
Mean: 827.376 ms
Stdev: 26.414 ms (3.2%)
Runs: 767.7000290001743 777.7670869999565 777.9390899999999 796.9186399998143 797.1119949999265 802.6030600001104 809.909368999768 811.1107180002145 815.6569860000163 817.3614570000209 820.6290270001628 821.169579999987 826.0446210000664 828.7662399997935 830.0317259998992 831.6212140000425 834.0530779999681 834.7387959999032 835.3439650000073 835.6186830000952 842.8848669999279 846.0276379999705 850.0222479999065 850.6711749997921 850.9475449998863 852.1745339999907 852.646344000008 857.9708540001884 860.2816989999264 885.5589410001412
nativeLaunch Baseline
Mean: 9.129 ms
Stdev: 1.431 ms (15.7%)
Runs: 7 7 8 8 8 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 10 10 10 10 11 11 11 11 12 13

Current
Mean: 9.172 ms
Stdev: 0.949 ms (10.4%)
Runs: 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 9 9 10 10 10 10 10 10 10 11 11 11
regularAppStart Baseline
Mean: 0.014 ms
Stdev: 0.001 ms (6.0%)
Runs: 0.012614000122994184 0.0134680001065135 0.01346899988129735 0.01358999963849783 0.013712000101804733 0.013712999876588583 0.01383400009945035 0.0138349998742342 0.0138349998742342 0.013916000258177519 0.013956999871879816 0.013996999710798264 0.014038000255823135 0.0143630001693964 0.01436399994418025 0.01444500032812357 0.014525999780744314 0.014527000021189451 0.014607999939471483 0.01460800040513277 0.014688999857753515 0.014689000323414803 0.014771000016480684 0.014973999932408333 0.015055000316351652 0.015137000009417534 0.015217999927699566 0.015705999918282032 0.01582799991592765 0.01607199991121888 0.016844999976456165

Current
Mean: 0.015 ms
Stdev: 0.001 ms (7.3%)
Runs: 0.013346999883651733 0.013509000185877085 0.013630999717861414 0.013671999797224998 0.013712999876588583 0.013753000181168318 0.013753000181168318 0.013754000421613455 0.013875000178813934 0.013875999953597784 0.013916000258177519 0.0139979999512434 0.014037999790161848 0.014078000094741583 0.014159999787807465 0.014161000028252602 0.014240999706089497 0.014281999785453081 0.014282000251114368 0.01444500032812357 0.014527000021189451 0.014811000321060419 0.014934000093489885 0.01525900000706315 0.01534000039100647 0.015625 0.016316999681293964 0.016358000226318836 0.01643800036981702 0.016682999674230814 0.016723000444471836 0.016927999909967184

@OSBotify
Copy link
Contributor

🚀 Deployed to production by @chiragsalian in version: 1.2.40-3 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants