Expensify / App

Welcome to New Expensify: a complete re-imagination of financial collaboration, centered around chat. Help us build the next generation of Expensify by sharing feedback and contributing to the code.
https://new.expensify.com
MIT License
3.56k stars 2.9k forks source link

[HOLD for payment 2023-10-24] [$500] Email not found in new workspace after adding as member, splitting bill, deleting old workspace. #29024

Closed m-natarajan closed 1 year ago

m-natarajan commented 1 year ago

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Action Performed:

  1. Create new account > Settings > Create workspace > Members > Add members (copy email for step 4)
  2. Go to Announcement > Plus sign > Split bill > Add numbers > Split bill
  3. Go to Workspace > Three dots > Delete workspace
  4. Go back to Settings > Create workspace > Members > Add members > Paste copied email into workspace

    Expected Result:

    Email should be found when searching for it in the newly created workspace.

    Actual Result:

    Email cannot be found when searching for it in the newly created workspace.

Workaround:

unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

Version Number: 1.3.73-9 Reproducible in staging?: y Reproducible in production?: y If this was caught during regression testing, add the test name, ID and link from TestRail: Email or phone of affected tester (no customers): Logs: https://stackoverflow.com/c/expensify/questions/4856 Notes/Photos/Videos: Any additional supporting documentation

https://github.com/Expensify/App/assets/38435837/d6ecb509-bec2-44b5-b3cb-e8a91d427f01

https://github.com/Expensify/App/assets/38435837/980d760e-07e7-42d0-a911-54c150d97fda

https://github.com/Expensify/App/assets/38435837/fc18cb1c-5d83-4fbc-b0ff-2c816a6fa95a

https://github.com/Expensify/App/assets/38435837/76e6e1e9-6b12-44dc-80aa-03d726f010ce

https://github.com/Expensify/App/assets/38435837/d7dc3254-3e11-444a-975b-44b3b0ec3ea2

https://github.com/Expensify/App/assets/38435837/01ab802f-eb83-4312-9618-6ce4fa31892d

https://github.com/Expensify/App/assets/38435837/1bfcba0d-a011-4daa-af77-84dfac706dc7

Expensify/Expensify Issue URL: Issue reported by: @tewodrosGirmaA Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1696584062077569

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01045d4102dd433123
  • Upwork Job ID: 1710349407654047744
  • Last Price Increase: 2023-10-06
  • Automatic offers:
    • hoangzinh | Reviewer | 27135873
    • c3024 | Contributor | 27135874
    • tewodrosGirmaA | Reporter | 27135875
Issue OwnerCurrent Issue Owner: @peterdbarkerUK
Issue OwnerCurrent Issue Owner: @peterdbarkerUK
c3024 commented 1 year ago

Proposal

Please re-state the problem that we are trying to solve in this issue.

Cannot invite a member X to a workspace B if X was added to a workspace A, then split a bill with X and then the workspace A is deleted.

What is the root cause of that problem?

When we create a split request this here https://github.com/Expensify/App/blob/a6d2f3e3564c19f32caba3837a81adc837f6c752/src/libs/actions/IOU.js#L1060-L1065 checks if there is one to one chat report and if does not exists it sets shouldCreateOptimisticPersonalDetails to true even though a personal detail exists and this here https://github.com/Expensify/App/blob/5dc3c25aa776aef3cedc45e6638734c9ee85a2f2/src/libs/actions/IOU.js#L1122 sets isOptimisticPersonalDetail to true and subsequently through buildOnyxDataForMoneyRequest, the personal detail is set with field isOptimisticPersonalDetail to true. This here

https://github.com/Expensify/App/blob/5dc3c25aa776aef3cedc45e6638734c9ee85a2f2/src/libs/OptionsListUtils.js#L1262

does not show this optimistic personal detail and also no option is created because it already exists in personal details.

What changes do you think we should make in order to solve the problem?

We need to check if the accountID already exists in the personal details and if it does we should not change shouldCreateOptimisticPersonalDetails to true. So we can subscribe to personal details in IOU and add this

const personalDetailExists = _.has(allPersonalDetails, accountID)

here https://github.com/Expensify/App/blob/5dc3c25aa776aef3cedc45e6638734c9ee85a2f2/src/libs/actions/IOU.js#L1051 and change these https://github.com/Expensify/App/blob/5dc3c25aa776aef3cedc45e6638734c9ee85a2f2/src/libs/actions/IOU.js#L1059 https://github.com/Expensify/App/blob/5dc3c25aa776aef3cedc45e6638734c9ee85a2f2/src/libs/actions/IOU.js#L1063 to

shouldCreateOptimisticPersonalDetails = !existingSplitChatReport && !personalDetailExists;
shouldCreateOptimisticPersonalDetails = isNewOneOnOneChatReport && !personalDetailExists;

What alternative solutions did you explore? (Optional)

We might consider changing the logic here https://github.com/Expensify/App/blob/5dc3c25aa776aef3cedc45e6638734c9ee85a2f2/src/libs/actions/IOU.js#L1061 to include the accountID of current user when we get report by participants or have a function to check if there is a chat with this participant instead of checking if a report has all participants like the existing getChatbyParticipants

Result https://github.com/Expensify/App/assets/102477862/e6f20504-604e-4449-b918-33dc4e7e551f
melvin-bot[bot] commented 1 year ago

Job added to Upwork: https://www.upwork.com/jobs/~01045d4102dd433123

melvin-bot[bot] commented 1 year ago

Triggered auto assignment to Contributor-plus team member for initial proposal review - @hoangzinh (External)

melvin-bot[bot] commented 1 year ago

@hoangzinh Whoops! This issue is 2 days overdue. Let's get this updated quick!

hoangzinh commented 1 year ago

Reviewing proposal. Btw @m-natarajan could you help to add "Bug" label to this issue in order to have a BZ member assigned to this issue? Thanks

melvin-bot[bot] commented 1 year ago

Triggered auto assignment to @peterdbarkerUK (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

melvin-bot[bot] commented 1 year ago

Bug0 Triage Checklist (Main S/O)

hoangzinh commented 1 year ago

@c3024 Thanks for your proposal. It looks good to me. Your proposal pointed out a correct RCA and the solution makes sense. We should only create an optimisticPersonalDetails during split bill if it does not exist.

Thus, I think we go with @c3024's proposal here https://github.com/Expensify/App/issues/29024#issuecomment-1751175182

πŸŽ€πŸ‘€πŸŽ€ C+ reviewed

melvin-bot[bot] commented 1 year ago

Triggered auto assignment to @Gonals, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

melvin-bot[bot] commented 1 year ago

πŸ“£ @hoangzinh πŸŽ‰ An offer has been automatically sent to your Upwork account for the Reviewer role πŸŽ‰ Thanks for contributing to the Expensify app!

Offer link Upwork job

melvin-bot[bot] commented 1 year ago

πŸ“£ @c3024 πŸŽ‰ An offer has been automatically sent to your Upwork account for the Contributor role πŸŽ‰ Thanks for contributing to the Expensify app!

Offer link Upwork job Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review πŸ§‘β€πŸ’» Keep in mind: Code of Conduct | Contributing πŸ“–

melvin-bot[bot] commented 1 year ago

πŸ“£ @tewodrosGirmaA πŸŽ‰ An offer has been automatically sent to your Upwork account for the Reporter role πŸŽ‰ Thanks for contributing to the Expensify app!

Offer link Upwork job

melvin-bot[bot] commented 1 year ago

Based on my calculations, the pull request did not get merged within 3 working days of assignment. Please, check out my computations here:

On to the next one πŸš€

hoangzinh commented 1 year ago

I think it's more fair for Contributors if this issue is considered for the speed bonus because the 1st round approval is within a half day. @c3024 and I quickly made & tested the PR as soon as possible.

Screenshot 2023-10-16 at 21 55 17

Screenshot 2023-10-16 at 21 54 29

peterdbarkerUK commented 1 year ago

Agreed, speed bonus should be included here.

melvin-bot[bot] commented 1 year ago

Reviewing label has been removed, please complete the "BugZero Checklist".

melvin-bot[bot] commented 1 year ago

The solution for this issue has been :rocket: deployed to production :rocket: in version 1.3.85-4 and is now subject to a 7-day regression period :calendar:. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2023-10-24. :confetti_ball:

After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.

For reference, here are some details about the assignees on this issue:

As a reminder, here are the bonuses/penalties that should be applied for any External issue:

melvin-bot[bot] commented 1 year ago

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

peterdbarkerUK commented 1 year ago

Summarizing payouts for this issue:

Issue reporter: @tewodrosGirmaA $50

Contributor: @c3024 $750

Upwork Job

peterdbarkerUK commented 1 year ago

@hoangzinh please complete the above checklist and I'll process your payment too!

hoangzinh commented 1 year ago

BugZero Checklist:

hoangzinh commented 1 year ago

Regression Test Proposal

  1. Create a workspace X
  2. Invite a user A to workspace X
  3. Go to #announce room of workspace X
  4. Split a bill in this room with the user A
  5. Delete the workspace X
  6. Create another workspace Y
  7. Go to the Invite page of workspace Y
  8. Verify that user A is shown in the options below the search input.

Do we agree πŸ‘ or πŸ‘Ž

melvin-bot[bot] commented 1 year ago

@hoangzinh, @peterdbarkerUK, @Gonals, @c3024 Huh... This is 4 days overdue. Who can take care of this?

peterdbarkerUK commented 1 year ago

Thanks @hoangzinh - I noticed you skipped the PR Review Checklist discussion step. Could you help me understand if and when that step is required? (I've asked this internally too)

hoangzinh commented 1 year ago

Yeah, because I think it's not a straightforward bug. It's hard to catch kind of this bug from the beginning.

peterdbarkerUK commented 1 year ago

Thanks @hoangzinh - I'm new to BZ and still learning how to handle the judgment call elements of instructions. And, candidly, trying to identify steps we can remove as unnecessary.

On that note of me not being very good yet: image

seems to me this is an edge case we don't need to test for in TestRail. I should have done this step earlier and saved you some bureaucracy. Would you agree?

hoangzinh commented 1 year ago

No worry @peterdbarkerUK.

seems to me this is an edge case we don't need to test for in TestRail

I feel it's not an edge case. In a workspace, we split the bill to some users, then we delete this workspace and create a new workspace, we would like to add previous users to this new workspace. I'm 50:50 on it.

what do you think? @c3024 @Gonals do you agree this issue is an edge case? Thanks

c3024 commented 1 year ago

"Deleting workspace A" is not a required step.

I think this is not an edge case bug.

As long as we split bill with a user (whose personal details are already returned from backend) with whom we don't have a one-to-one chat already, we will face this bug. And this user option does not appear in any option list because this is turned into an optimistic detail.

While this might not be a frequent flow, this flow can happen sometimes and this bug is a bit more than an edge case bug in my opinion.

peterdbarkerUK commented 1 year ago

Yeah, I'd agree with that. In which case should the regression test be:

  1. Create a workspace X
  2. Invite a new user A to workspace X
  3. Go to #announce room of workspace X
  4. Split a bill in this room with the user A
  5. Create another workspace Y
  6. Go to the Invite page of workspace Y
  7. Verify that user A is shown in the options below the search input.
peterdbarkerUK commented 1 year ago

TR update proposed, thanks everyone!

hoangzinh commented 1 year ago

@peterdbarkerUK let me know when the payment is processed for me in Upwork. Thanks

peterdbarkerUK commented 1 year ago

Ugh, I lost that in the regression test uncertainty. I'm sorry. Payment sent!

Job closed