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

fix: fix lhn previews #31061

Merged

Conversation

koko57
Copy link
Contributor

@koko57 koko57 commented Nov 8, 2023

Details

Fixed Issues

$ #30042
PROPOSAL: $ #30042 (comment)

Tests

Create an iouReport

  1. Global Create > Request Money > $50 > choose a person > Confirm
  2. Land in the DM
  3. Look at the LHN row to observe the preview

request action preview (requestor view)

Tom Rhys Jones owes $50.00
requested 10.00

request action preview (payer view)

Tom Rhys Jones owes $50.00
Agata: requested 10.00

DMs:
owed iouReport being previewed (Agata view - DM)

Tom Rhys Jones
Tom Rhys Jones owes $50.00

owed iouReport being previewed (Tom view - DM)

Agata Kosior
Tom Rhys Jones owes $50.00

Create an expenseReport

  1. Create a workspace if you need to
  2. Global Create > Request Money > $50 > choose the workspace > confirm
  3. Land in the workspace chat
  4. Look at the LHN row to observe the preview

Request action preview (admin viewer)

Duraflame owes $100.00
Tom: requested $50.00

Request action preview (requestor viewer)

Duraflame owes $100.00
requested $50.00

owed expenseReport being previewed (member view - workspace chat)

Duraflame
Duraflame owes $50.00

owed expenseReport being previewed (admin view - workspace chat)

Tom Rhys Jones
Duraflame owes $50.00

Pay an iouReport

  1. Navigate to the iouReport view
  2. Click Pay elsewhere green button at the top right of the report

paid action preview (requestor view)

Tom Rhys Jones paid $50.00
Tom: paid $50.00 elsewhere

paid action preview (payer view)

Tom Rhys Jones paid $50.00
paid $50.00 elsewhere

paid iouReport being previewed (Agata view - DM)

Tom Rhys Jones
Tom Rhys Jones paid $50.00

paid iouReport being previewed (Tom view - DM)

Agata Kosior
Tom Rhys Jones paid $50.00

Pay an expenseReport

  1. Navigate to the expenseReport view
  2. Click Pay elsewhere green button at the top right of the report
  3. Observe the system message added to the expenseReport
  4. Observe the LHN preview

Paid action preview (admin viewer)

Duraflame paid $100.00
paid $100.00 elsewhere

paid action preview (requestor viewer)

Duraflame paid $100.00
Agata: paid $100.00 elsewhere

paid expenseReport being previewed (member view - workspace chat)

Duraflame
Duraflame paid $50.00

paid expenseReport being previewed (admin view - workspace chat)

Tom Rhys Jones
Duraflame paid $50.00

Add a comment

comment preview (sender view)

Tom Rhys Jones owes $50.00 <--- note: this is obviously variable dependent on if the report title is owed or paid
blah, blah, I love apples!

comment preview (receiver view)

Tom Rhys Jones owes $50.00 <--- note: this is obviously variable dependent on if the report title is owed or paid
Tom: blah, blah, I love apples!

comment preview (comment sender viewer)

Duraflame owes $100.00 <--- note: this is obviously variable dependent on if the report title is owed or paid
blah blah, I love bananas!

comment preview (comment receiver viewer)

Duraflame owes $100.00 <--- note: this is obviously variable dependent on if the report title is owed or paid
Tom: blah blah, I love bananas!

  • Verify that no errors appear in the JS console

Offline tests

N/A

QA Steps

Same as above

  • 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:
    • Android / native
    • Android / Chrome
    • iOS / native
    • iOS / Safari
    • MacOS / Chrome / Safari
    • 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 the left part of a conditional rendering a React component is a boolean and NOT a string, e.g. myBool && <MyComponent />.
    • 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
      • If any non-english text was added/modified, I verified the translation was requested/reviewed in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    • 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 grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is 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
    • If we are not using the full Onyx data that we loaded, I've added the proper selector in order to ensure the component only re-renders when the data it is using changes
      • 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 code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • 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 the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • 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.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR author checklist, including those that don't apply to this PR.

Screenshots/Videos

Android: Native

Screenshot_1699471206

Android: mWeb Chrome Screenshot 2023-11-09 at 09 59 02
iOS: Native

Simulator Screen Shot - iPhone 14 Pro - 2023-11-08 at 20 21 42
Simulator Screen Shot - iPhone 14 Pro - 2023-11-08 at 20 21 14

iOS: mWeb Safari

Simulator Screen Shot - iPhone 14 Pro - 2023-11-08 at 19 25 38

MacOS: Chrome / Safari

EXPENSE REPORT

Request action preview (admin viewer)

Duraflame owes $100.00
Tom: requested $50.00

Screenshot 2023-11-08 at 14 28 54

Request action preview (requestor viewer)

Duraflame owes $100.00
requested $50.00

Screenshot 2023-11-08 at 14 29 21

Paid action preview (admin viewer)

Duraflame paid $100.00
paid $100.00 elsewhere

Screenshot 2023-11-08 at 14 30 43

paid action preview (requestor viewer)

Duraflame paid $100.00
Agata: paid $100.00 elsewhere

Screenshot 2023-11-08 at 14 31 20

comment preview (comment sender viewer)

Duraflame owes $100.00 <--- note: this is obviously variable dependent on if the report title is owed or paid
blah blah, I love bananas!

Screenshot 2023-11-08 at 18 28 17

comment preview (comment receiver viewer)

Duraflame owes $100.00 <--- note: this is obviously variable dependent on if the report title is owed or paid
Tom: blah blah, I love bananas!

Screenshot 2023-11-08 at 18 27 26

IOU REPORT

request action preview

Tom Rhys Jones owes $50.00
Tom: requested 10.00

Screenshot 2023-11-08 at 16 33 06

paid action preview

Tom Rhys Jones paid $50.00
Tom: paid $50.00 elsewhere

Screenshot 2023-11-08 at 16 33 46

comment preview

Tom Rhys Jones owes $50.00 <--- note: this is obviously variable dependent on if the report title is owed or paid
Tom: blah, blah, I love apples!

Screenshot 2023-11-08 at 18 26 38

DM / WORKSPACE CHAT

owed iouReport being previewed (Agata view - DM)

Tom Rhys Jones
Tom Rhys Jones owes $50.00

Screenshot 2023-11-08 at 16 46 28

owed iouReport being previewed (Tom view - DM)

Agata Kosior
Tom Rhys Jones owes $50.00

Screenshot 2023-11-08 at 16 49 09

paid iouReport being previewed (Agata view - DM)

Tom Rhys Jones
Tom Rhys Jones paid $50.00

Screenshot 2023-11-08 at 16 49 45

paid iouReport being previewed (Tom view - DM)

Agata Kosior
Tom Rhys Jones paid $50.00

Screenshot 2023-11-08 at 16 49 32

owed expenseReport being previewed (member view - workspace chat)

Duraflame
Duraflame owes $50.00

Screenshot 2023-11-08 at 16 51 26

owed expenseReport being previewed (admin view - workspace chat)

Tom Rhys Jones
Duraflame owes $50.00

Screenshot 2023-11-08 at 16 51 40

paid expenseReport being previewed (member view - workspace chat)

Duraflame
Duraflame paid $50.00

Screenshot 2023-11-08 at 16 39 12

paid expenseReport being previewed (admin view - workspace chat)

Tom Rhys Jones
Duraflame paid $50.00

Screenshot 2023-11-08 at 16 37 54
MacOS: Desktop

all examples like in MacOS: Chrome / Safari

Screenshot 2023-11-08 at 19 08 53 Screenshot 2023-11-08 at 19 09 12 Screenshot 2023-11-08 at 19 09 27 Screenshot 2023-11-08 at 19 09 31 Screenshot 2023-11-08 at 19 09 45

Copy link
Contributor

@rezkiy37 rezkiy37 left a comment

Choose a reason for hiding this comment

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

Left minor comments.

src/libs/ReportUtils.js Outdated Show resolved Hide resolved
src/libs/ReportUtils.js Outdated Show resolved Hide resolved
src/libs/OptionsListUtils.js Outdated Show resolved Hide resolved
src/languages/en.ts Show resolved Hide resolved
src/languages/en.ts Show resolved Hide resolved
src/languages/en.ts Show resolved Hide resolved
src/languages/en.ts Show resolved Hide resolved
src/languages/en.ts Show resolved Hide resolved
@koko57 koko57 marked this pull request as ready for review November 9, 2023 19:50
@koko57 koko57 requested a review from a team as a code owner November 9, 2023 19:50
@melvin-bot melvin-bot bot requested review from mananjadhav and removed request for a team November 9, 2023 19:50
Copy link

melvin-bot bot commented Nov 9, 2023

@mananjadhav 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]

@mountiny
Copy link
Contributor

@mananjadhav this is ready for a review, let us know if you need anything

@mananjadhav
Copy link
Collaborator

@mountiny Thanks I'll have this reviewed. For now, I am going through all the responses by @trjExpensify again, but can we get a confirmation on the QA cases? Do we have any other cases to cover?

@mountiny
Copy link
Contributor

I think the QA cases are good and how it should look like you can see in the latest comments in the issue

@mananjadhav
Copy link
Collaborator

Code changes are fine. @koko57 Can you please merge with the latest main? and I'll start with the testing.

@mananjadhav
Copy link
Collaborator

Also @koko57 can we add the expected results in the Tests section. I can see we end every test with Observe the preview. Instead if it can be UserA owes $12.6, it would be better. These could be easier to add to the regression tests as well. Thanks for the patience here.

@koko57
Copy link
Contributor Author

koko57 commented Nov 14, 2023

@mananjadhav all the results are in the MacOS Chrome / Safari but I can copy paste it higher (I didn't want to make the checklist so long)

@koko57
Copy link
Contributor Author

koko57 commented Nov 14, 2023

@mananjadhav merged with main 🙂

@dylanexpensify
Copy link
Contributor

@mananjadhav mind getting this across the line today??

@mananjadhav
Copy link
Collaborator

Still QAing. Will need a day to work on this. Thanks for the patience.

@melvin-bot melvin-bot bot requested a review from mountiny November 22, 2023 20:54
@mountiny
Copy link
Contributor

@koko57 last merge conflict 🥺

@koko57
Copy link
Contributor Author

koko57 commented Nov 23, 2023

@mananjadhav fixed!

mountiny
mountiny previously approved these changes Nov 23, 2023
Copy link
Contributor

@mountiny mountiny left a comment

Choose a reason for hiding this comment

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

@koko57 Just couple of styling comments

* @param {Boolean} [isPreviewMessageForParentChatReport]
* @returns {String}
*/

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change

*/

function getReportPreviewMessageForOptionList(report, reportAction, isPreviewMessageForParentChatReport = false) {
// for the request action preview we want to show the requestor instead of the user who owes the money
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// for the request action preview we want to show the requestor instead of the user who owes the money
// For the request action preview we want to show the requestor instead of the user who owes the money

* @param {Object} [policy]
* @returns {String}
*/

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change

src/libs/OptionsListUtils.js Show resolved Hide resolved
* @param {Boolean} [shouldShowWorkspaceName]
* @param {Boolean} [shouldUseShortForm]
* @param {Object} [policy]
* @returns {String}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* @returns {String}
* @returns {String}

* @param {Number} actorID
* @param {Boolean} [shouldShowWorkspaceName]
* @param {Boolean} [shouldUseShortForm]
* @param {Object} [policy]
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* @param {Object} [policy]
* @param {Object|undefined} [policy]

Copy link
Contributor

@mountiny mountiny left a comment

Choose a reason for hiding this comment

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

Thank you for patience and getting through this one @koko57 🚀

@mountiny
Copy link
Contributor

And thanks for testing thoroughly @mananjadhav

@mountiny mountiny merged commit 9f16cce into Expensify:main Nov 23, 2023
16 checks passed
@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.

@OSBotify
Copy link
Contributor

🚀 Deployed to staging by https://github.com/mountiny in version: 1.4.3-0 🚀

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

@OSBotify
Copy link
Contributor

🚀 Deployed to staging by https://github.com/mountiny in version: 1.4.3-0 🚀

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

* @param {Boolean} [isPreviewMessageForParentChatReport]
* @returns {String}
*/
function getReportPreviewMessageForOptionList(report, reportAction, isPreviewMessageForParentChatReport = false) {
Copy link
Contributor

Choose a reason for hiding this comment

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

@luacmartins I think we can just set default value here:

Suggested change
function getReportPreviewMessageForOptionList(report, reportAction, isPreviewMessageForParentChatReport = false) {
function getReportPreviewMessageForOptionList(report, reportAction = {}, isPreviewMessageForParentChatReport = false) {

This was old code: https://github.com/Expensify/App/pull/31061/files#diff-65c096044d5f69b35bcdec14c99c4fda4580759df9b1a7c36650d58eea276f1dR1861

Copy link
Contributor

Choose a reason for hiding this comment

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

that will prevent the crash, yes, but why don't we have any reportActions for the given report? When I load the given report I do see reportActions

Copy link
Contributor

Choose a reason for hiding this comment

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

it may be that the reportActions are only missing for a brief moment while loading/updating onyx

@luacmartins
Copy link
Contributor

We have another blocker coming from this PR - #31844 so I'm gonna revert it and we can work on a fix without blocking the deploy.

@luacmartins
Copy link
Contributor

Another potential blocker - #31833

@mananjadhav
Copy link
Collaborator

Thanks for highlighting. We'll get it fixed in v2. @mountiny @koko57 Makes sense to figure out a way to add tests on this one ? I think this did break too many areas.

@mountiny
Copy link
Contributor

This area is super brittle which makes it very annoying to work with, I wish we could add in some automated tests which can catch more of this stuff.

Alas, we should at least take all the regressions and add them as test steps for the next try.

@OSBotify
Copy link
Contributor

🚀 Deployed to production by https://github.com/AndrewGable in version: 1.4.3-11 🚀

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

@koko57 koko57 deleted the fix/30042-fix-lhn-previews-and-report-actions branch January 17, 2024 18:39
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.