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

Refactor "new action" logic in ReportActionsView to fix new marker #12169

Merged
merged 8 commits into from
Nov 7, 2022

Conversation

marcaaron
Copy link
Contributor

@marcaaron marcaaron commented Oct 27, 2022

Details

Fixed Issues

$ #11726

Tests

Same as QA

  • Verify that no errors appear in the JS console

QA Steps

New message marker set correctly when report is default while signing in

  1. Open two sessions one as User A and one as User B
  2. Make sure User B is navigated to the chat with User A
  3. Sign out User B
  4. Create message as User A on chat with User B and wait 10 seconds
  5. Sign in User B
  6. Verify the chat with User A loads
  7. Verify that new marker is set correctly
  8. Verify that the chat in the LHN is marked as read

New message marker set correctly when navigating to unread chat after signing in

  1. Open two sessions one as User A and one as User B
  2. Make sure User B is navigate to a chat other than the chat with User A
  3. Sign out User B
  4. Create message as User A on chat with User B and wait 10 seconds
  5. Sign in User B
  6. Navigate to chat with User A as User B
  7. Verify that new marker is set correctly
  8. Verify that the chat in the LHN is marked as read

New message marker set correctly when navigating to unread chat after opening app

  1. Open two sessions one as User A and one as User B
  2. Make sure User B is navigate to a chat other than the chat with User A
  3. Close tab (or kill app) with User B (Do not sign out)
  4. Create message as User A on chat with User B and wait 10 seconds
  5. Open a new tab (or app) as User B
  6. Navigate to chat with User A as User B
  7. Verify that new marker is set correctly
  8. Verify that the chat in the LHN is marked as read

New message marker set correctly when navigating to directly to unread chat

  1. Open two sessions one as User A and one as User B
  2. Make sure User B is navigate to the chat with User A and save the URL
  3. Close User B tab (or kill app)
  4. Create message as User A on chat with User B and wait 10 seconds
  5. Open tab (or app) as User B using the URL saved from the second step (on native use a deep link)
  6. See that new marker is set correctly
  7. Verify that the chat in the LHN is marked as read
  • Verify that no errors appear in the JS console

PR Review Checklist

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 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 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 was added in all src/languages/* files
    • 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
  • 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 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.
  • I have checked off every checkbox in the PR author checklist, including those that don't apply to this PR.

PR Reviewer Checklist

The reviewer will copy/paste it into a new comment and complete it after the author checklist is completed

  • 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 was added in all src/languages/* files
    • 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 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.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots

QA testing is intense for these flows as there are 4 test cases to look at. I'm only posting videos for 1 scenario, but they should all be tested.

Web

2022-11-01_12-46-08.mp4

Mobile Web - Chrome

2022-11-01_13-49-44.mp4

Mobile Web - Safari

2022-11-01_13-40-23.mp4

Desktop

2022-11-01_12-51-27.mp4

iOS

2022-11-01_13-22-17.mp4

Android

2022-11-01_13-46-41.mp4

@marcaaron marcaaron changed the title [WIP] Refactor "new action" logic in ReportActionsView to fix new marker Refactor "new action" logic in ReportActionsView to fix new marker Nov 1, 2022
@marcaaron marcaaron marked this pull request as ready for review November 1, 2022 23:55
@marcaaron marcaaron requested a review from a team as a code owner November 1, 2022 23:55
@melvin-bot melvin-bot bot requested review from Beamanator and parasharrajat and removed request for a team November 1, 2022 23:55
src/libs/actions/Report.js Outdated Show resolved Hide resolved
src/pages/home/ReportScreen.js Outdated Show resolved Hide resolved
@Beamanator
Copy link
Contributor

Sorry didn't get to review today, will prioritize this tomorrow

@marcaaron
Copy link
Contributor Author

Updated

@parasharrajat
Copy link
Member

Testing...

Copy link
Contributor

@Beamanator Beamanator left a comment

Choose a reason for hiding this comment

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

Looking good & testing well for me, I like the loads of comments since we're doing some funky stuff, but overall it's making sense 👍 Won't merge till @parasharrajat does his review

@parasharrajat
Copy link
Member

I am facing some issues with Mac so I won't be able to test all platforms until that issue is fixed.

Hoping to get it fixed asap and get back on it.

  • Thanks

@marcaaron
Copy link
Contributor Author

@Beamanator Can you jump in here and help test on all platforms? We need at least one person to post the checklist.

@Beamanator
Copy link
Contributor

Fak I'm no longer at my laptop for about 5 hours, sorry - can test Sunday if that's ok for you

@Beamanator
Copy link
Contributor

IOS App w/ Chrome

When logging out / logging in:

Screen.Recording.2022-11-07.at.3.23.36.PM.mov

When closing & opening app (notice the new message shows in iOS LHN, when opening the report it is shown a bit late w/ an animation - is that on purpose?):

Screen.Recording.2022-11-07.at.3.25.31.PM.mov

iOS Safari w/ Android

When logging out / logging in:

Screen.Recording.2022-11-07.at.3.39.42.PM.mov

When closing & opening app (looks like iOS Safari mWeb didn't get the "unread" marker 🤔 :

Screen.Recording.2022-11-07.at.3.41.40.PM.mov

but it worked this way??

Screen.Recording.2022-11-07.at.3.44.54.PM.mov

Android Chrome w/ Desktop

When logging out / logging in:

Screen.Recording.2022-11-07.at.3.47.44.PM.mov

When closing & opening app:

Screen.Recording.2022-11-07.at.3.48.46.PM.mov

@Beamanator
Copy link
Contributor

  • 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 was added in all src/languages/* files
    • 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 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.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

@Beamanator Beamanator merged commit 449888a into main Nov 7, 2022
@Beamanator Beamanator deleted the marcaaron-newMarkerFix branch November 7, 2022 13:53
@OSBotify
Copy link
Contributor

OSBotify commented Nov 7, 2022

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

@marcaaron
Copy link
Contributor Author

Thanks for testing @Beamanator !

notice the new message shows in iOS LHN, when opening the report it is shown a bit late w/ an animation - is that on purpose?

Expected, yes! It's just a consequence of how we load reports first then load comments second when tapping into the chat. There are some discussions floating around about how to improve this IIRC.

When closing & opening app (looks like iOS Safari mWeb didn't get the "unread" marker

Hmm hard to say, but I think I'd expect that to work. I probably would have rejected this PR for not passing the test steps. But we can see if it happens for QA and if a new issue needs to be created we'll look into it.

@OSBotify
Copy link
Contributor

OSBotify commented Nov 8, 2022

🚀 Deployed to staging by @Beamanator in version: 1.2.25-0 🚀

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

@OSBotify
Copy link
Contributor

OSBotify commented Nov 9, 2022

🚀 Deployed to production by @yuwenmemon in version: 1.2.25-0 🚀

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

@marcaaron
Copy link
Contributor Author

marcaaron commented Nov 15, 2022

Heads up @Beamanator @parasharrajat elements of this PR were reverted because they caused a pretty nasty regression related to offline behavior here. I think we can all learn from this PR by making sure to test offline behaviors and include them in the test steps for our future PRs. Thanks.

@parasharrajat
Copy link
Member

parasharrajat commented Nov 15, 2022

Sadly, I didn't get the chance to test it. But I agree offline testing is a must for this PR.

@marcaaron
Copy link
Contributor Author

offline testing is a must for this PR all PRs ? 😄

@parasharrajat
Copy link
Member

Correct 😅 . Saw your update.

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