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

Create splitBill in the client #11597

Merged
merged 107 commits into from
Oct 31, 2022
Merged

Create splitBill in the client #11597

merged 107 commits into from
Oct 31, 2022

Conversation

luacmartins
Copy link
Contributor

@luacmartins luacmartins commented Oct 4, 2022

cc @mountiny @Gonals since you are familiar with the IOU changes

Details

Enables optimistic bill split functionality

Fixed Issues

$ https://github.com/Expensify/Expensify/issues/213664

Tests

Pull changes from Auth and Web-E

Offline

  1. From the global create menu +, select Split bill
  2. Go through the prompt and select TWO or MORE participants and submit the request, verify that:
  • The group chat is created with those participants and you are navigated to it (the whole chat should be greyed out)
  • The group chat has a message Split $X with <user1> and <user2> (this should be greyed out)
  • Individual chats with each participant are created (these chats should be greyed out)
  • Individual chats have the IOU message and preview (these messages should be greyed out)

Screen Shot 2022-10-18 at 12 46 28 PM

  1. From the group chat, tap + > Split bill and send another split bill request
  2. Verify that the modal is dismissed
  3. Verify that another split message shows up in the group chat (this message should be greyed out)
  4. Verify that each individual chat with and show the new request and the total has been updated (these messages should be greyed out)

Online

  1. Turn on your internet connection and verify that the chats and messages are still the same, but are no longer greyed out.
  2. From the global create, + > Split bill and go through the prompts selecting only ONE participant:
  3. Submit the split request and verify that:
  • The not found page and the chat skeleton don't briefly show up before the chat is shown
  • An Individual chat with the selected user is created
  • The Individual chat has the IOU message and preview

Error

  1. Login in NewDot with account A in web
  2. Login in NewDot with the same account A in web in incognito window
  3. Use network tools to disable connection in the incognito window
  4. In the non-incognito window, create a split bill adding user B and C (this should work fine, internet is enabled)
  5. In the incognito window, still without connection, create an offline split bill adding users B and C
  6. Enable the internet connection in incognito windows, the split bill request will be sent and will get a response with the error below.
  7. You will see duplicated chats, one of each pair of duplicate will have an error because it failed to be created. Tapping the X in the message should remove the chat.

Screen Shot 2022-10-24 at 1 18 06 PM

  • 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 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 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 tagging the marketing team 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 */
    • Any functional components have the displayName property
    • 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.

QA Steps

Same as test steps.

  • Verify that no errors appear in the JS console

Screenshots

Web

web.mov

Mobile Web - Chrome

chrome.mov

Mobile Web - Safari

safari.mov

Desktop

desktop.mov

iOS

ios.mov

Android

android.mov

@luacmartins luacmartins self-assigned this Oct 4, 2022
@aldo-expensify
Copy link
Contributor

aldo-expensify commented Oct 31, 2022

@aldo-expensify just coming online also worked for me. The user details is sent via ReconnectApp in that case.

hmm I'm not sure what it may be, but I can still reproduce it. I see that the ReconnectApp is missing the personal details for the other account:

image

I just updated Web-Expensify and I'm using main

@aldo-expensify
Copy link
Contributor

aldo-expensify commented Oct 31, 2022

I debugged and investigated this more: #11597 (comment) . It seems like I have a problem in my env and testing accounts. The function in the API that is supposed to find the personal details is not finding them for any account.

Copy link
Contributor

@aldo-expensify aldo-expensify left a comment

Choose a reason for hiding this comment

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

Tested well for me

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.

LGTM, havent run into an issue when testing. @thesahindia Would you be able to retest agains staging? The PR will be off hold after tomorrows deploy

@thesahindia
Copy link
Member

Same. Works well for me.

Just a question. Shouldn't we remove the unselect feature when user splits the bill from the fab menu since the user selected those users in the previous step?

Screen.Recording.2022-11-01.at.2.23.19.AM.mov

@luacmartins
Copy link
Contributor Author

Just a question. Shouldn't we remove the unselect feature when user splits the bill from the fab menu since the user selected those users in the previous step?

I think this is fine, it's a way for the user to quickly edit the participants in the confirmation page if they want to. We could definitely change this if we wanted to, but I don't think that's in scope for this PR.

@luacmartins
Copy link
Contributor Author

Thanks for all the tests everyone! This was a tricky one!

@luacmartins luacmartins changed the title [Hold Web-E 35342] Create splitBill in the client Create splitBill in the client Oct 31, 2022
@luacmartins
Copy link
Contributor Author

Removing the hold since Web-E PR is in staging and will likely make it to prod before this App PR makes it to prod. If that doesn't happen, we can CP the Web-E PR.

@luacmartins luacmartins merged commit 2174ef5 into main Oct 31, 2022
@luacmartins luacmartins deleted the cmartins-createSplitBill branch October 31, 2022 21:42
@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.

@thesahindia
Copy link
Member

@luacmartins, sorry for the ping here but we don't have an issue for this. Can we open an issue for the C+ compensation? Also can we increase the compensation on this? (since it was a big PR and took time in testing)

@thesahindia
Copy link
Member

Can we open an issue for the C+ compensation?

Just saw this thread.

According to the new process:
"If the E/E issue is a bug, a BZ is already assigned, internal engineer cc's the BZ in a comment on the PR so C+ knows who is paying. If the E/E isn't a bug, internal engineers add the Bug label to assign a BZ, then the engineer comments on the PR tagging the BZ who's assigned to issue payment."

@luacmartins
Copy link
Contributor Author

@thesahindia I started the process internally.

Also can we increase the compensation on this?

What compensation do you think is fair for this review?

@thesahindia
Copy link
Member

Thanks!

What compensation do you think is fair for this review?

I believe $500 will be fair.

@mallenexpensify
Copy link
Contributor

https://github.com/Expensify/Expensify/issues/213664#issuecomment-1299324320
@NicMendonca is the assigned BZ who will issue payment

@NicMendonca
Copy link
Contributor

@thesahindia sent you the offer, thanks!

@thesahindia
Copy link
Member

@NicMendonca, accepted🚀

@luacmartins
Copy link
Contributor Author

Nice! Thanks @NicMendonca! Are we good to close this issue?

@NicMendonca
Copy link
Contributor

Yep, just paid!

@OSBotify
Copy link
Contributor

OSBotify commented Nov 2, 2022

🚀 Deployed to staging by @luacmartins in version: 1.2.23-0 🚀

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

@OSBotify
Copy link
Contributor

OSBotify commented Nov 4, 2022

🚀 Deployed to production by @Julesssss in version: 1.2.23-9 🚀

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

@s77rt
Copy link
Contributor

s77rt commented May 15, 2023

This PR caused a bug #18472. The optimistic originalMessage is missing the participants object.

App/src/libs/ReportUtils.js

Lines 753 to 755 in d20ea60

if (type === CONST.IOU.REPORT_ACTION_TYPE.SPLIT) {
delete originalMessage.IOUReportID;
}

@Julesssss
Copy link
Contributor

This PR caused a bug #18472

This was merged a very long time ago, and at the time we didn't display the full Preview component for splits, so I don't think it's a true regression. I simply didn't add the 'add participants optimistically' when building the Bill Split preview.

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.

10 participants