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

[HOLD for payment 2024-01-26] [$500] Split - Split scan with existing group members is created in both existing and new group chat #34060

Closed
6 tasks done
lanitochka17 opened this issue Jan 5, 2024 · 34 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Weekly KSv2

Comments

@lanitochka17
Copy link

lanitochka17 commented Jan 5, 2024

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


Version Number: 1.4.22-0
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
Expensify/Expensify Issue URL:
Issue reported by: Applause - Internal Team
Slack conversation:

Action Performed:

  1. Click FAB > Request money > Manual
  2. Split bill with two users
  3. Click FAB > Request money > Scan
  4. Create a split scan request with the same two users in Step 2
    Note that the split scan creates two same groups, one with the history and another new group. The new group becomes skeleton placeholder after a while

Expected Result:

The split scan request will be created in the existing group chat which is created in Step 2

Actual Result:

The split scan request is created in both existing and new group chat. The request disappears and leaves skeleton placeholder after a while in the new group chat

Workaround:

Unknown

Platforms:

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

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

Bug6333455_1704483528937.bandicam_2024-01-05_18-27-06-548.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0147a95509543e3f60
  • Upwork Job ID: 1743366914858815488
  • Last Price Increase: 2024-01-12
  • Automatic offers:
    • bernhardoj | Contributor | 28104489
Issue OwnerCurrent Issue Owner: @stitesExpensify
@lanitochka17 lanitochka17 added External Added to denote the issue can be worked on by a contributor Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jan 5, 2024
@melvin-bot melvin-bot bot changed the title Split - Split scan with existing group members is created in both existing and new group chat [$500] Split - Split scan with existing group members is created in both existing and new group chat Jan 5, 2024
Copy link

melvin-bot bot commented Jan 5, 2024

Job added to Upwork: https://www.upwork.com/jobs/~0147a95509543e3f60

Copy link

melvin-bot bot commented Jan 5, 2024

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

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Jan 5, 2024
Copy link

melvin-bot bot commented Jan 5, 2024

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

Copy link

melvin-bot bot commented Jan 5, 2024

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

@unidev727
Copy link
Contributor

unidev727 commented Jan 5, 2024

Proposal

from: @unicorndev-727

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

Workspace - In Workspace, trying to add a number contact & selecting it, contact disappears

What is the root cause of that problem?

The root cause is that we are using randomly created reportId here.

const existingSplitChatReportID = CONST.REGEX.NUMBER.test(reportID) ? reportID : '';

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

We don't need to send reportId so that we can find reportId from getChatByParticipants here

selectedParticipants,
currentUserPersonalDetails.login,
currentUserPersonalDetails.accountID,
trimmedComment,
transaction.category,
transaction.tag,
receiptFile,
existingSplitChatReportID,
);

to

IOU.startSplitBill(
                    selectedParticipants,
                    currentUserPersonalDetails.login,
                    currentUserPersonalDetails.accountID,
                    trimmedComment,
                    transaction.category,
                    transaction.tag,
                    receiptFile
                );

App/src/libs/actions/IOU.js

Lines 1700 to 1702 in 7ae1ec7

const existingSplitChatReport =
existingSplitChatReportID || participants[0].reportID
? allReports[`${ONYXKEYS.COLLECTION.REPORT}${existingSplitChatReportID || participants[0].reportID}`]

screen-capture.2.webm

What alternative solutions did you explore?

We can find existing reportId using getChatByParticipants in ReportUtils for further correctness in IOURequestStepConfirmation page.
const existingSplitChatReportID = ReportUtils.getChatByParticipants(_.map(selectedParticipants, (participant) => Number(participant.accountID))) ?? '';

@bernhardoj
Copy link
Contributor

bernhardoj commented Jan 5, 2024

Proposal

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

Every time we create a new scan split bill, it will create the request on a new group chat.

What is the root cause of that problem?

If we create a scan split bill, it will call startSplitBill. In this function, we check if there is an existing group chat for the split bill, if it doesn't exist, we create a new one.

App/src/libs/actions/IOU.js

Lines 1700 to 1704 in 1752b97

const existingSplitChatReport =
existingSplitChatReportID || participants[0].reportID
? allReports[`${ONYXKEYS.COLLECTION.REPORT}${existingSplitChatReportID || participants[0].reportID}`]
: ReportUtils.getChatByParticipants(participantAccountIDs);
const splitChatReport = existingSplitChatReport || ReportUtils.buildOptimisticChatReport(participantAccountIDs);

The way we get the existing group chat is by checking either existingSplitChatReportID and participants[0]?.reportID (for policy expense chat). If it exists, we will get it from the report Onyx object. If not, we will get the report with getChatByParticipants.

However, after the big money request refactor, existingSplitChatReportID always exists because every time we open the money request page, we generate a new random report ID. So, we always trying to get the non-existing report because existingSplitChatReportID is not empty.

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

Because existingSplitChatReportID always exists, we can update the condition to,

const existingSplitChatReport = allReports[`${ONYXKEYS.COLLECTION.REPORT}${existingSplitChatReportID}`] || allReports[`${ONYXKEYS.COLLECTION.REPORT}${participants[0]?.reportID}`] || ReportUtils.getChatByParticipants(participantAccountIDs);

What alternative solutions did you explore? (Optional)

The existingSplitChatReportID logic also exists on normal splitBill, but if we look at the splitBill calls, we pass report.reportID to the existingSplitChatReportID params, so we can do the same.

IOU.splitBill(
selectedParticipants,
currentUserPersonalDetails.login,
currentUserPersonalDetails.accountID,
transaction.amount,
trimmedComment,
transaction.currency,
transaction.merchant,
transaction.category,
transaction.tag,
report.reportID,
);

@melvin-bot melvin-bot bot added the Overdue label Jan 8, 2024
@isabelastisser
Copy link
Contributor

@Santhosh-Sellavel please review the proposals above. Thanks!

@melvin-bot melvin-bot bot removed the Overdue label Jan 8, 2024
@isabelastisser
Copy link
Contributor

Bump @Santhosh-Sellavel

@Santhosh-Sellavel
Copy link
Collaborator

Thanks for the bump, I will update on this tomorrow.

@Santhosh-Sellavel
Copy link
Collaborator

Santhosh-Sellavel commented Jan 10, 2024

Both proposals are pretty much similar, will discuss them internally and update here.

Copy link

melvin-bot bot commented Jan 12, 2024

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@isabelastisser
Copy link
Contributor

@Santhosh-Sellavel any updates? Thanks!

@Santhosh-Sellavel
Copy link
Collaborator

Adding to get a CME here
C+ Reviewed
🎀 👀 🎀

Copy link

melvin-bot bot commented Jan 12, 2024

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

@Santhosh-Sellavel
Copy link
Collaborator

After looking again seems I missed @bernhardoj's alternate proposal, straightforward one. So let's go with them here, thanks!

C+ Reviewed
🎀 👀 🎀
cc: @stitesExpensify

Copy link

melvin-bot bot commented Jan 12, 2024

Current assignee @stitesExpensify is eligible for the choreEngineerContributorManagement assigner, not assigning anyone new.

@melvin-bot melvin-bot bot added the Overdue label Jan 14, 2024
Copy link

melvin-bot bot commented Jan 16, 2024

@isabelastisser, @stitesExpensify, @Santhosh-Sellavel Whoops! This issue is 2 days overdue. Let's get this updated quick!

@stitesExpensify
Copy link
Contributor

Agreed. Assigning @bernhardoj for their alternate proposal

@melvin-bot melvin-bot bot removed the Overdue label Jan 16, 2024
@melvin-bot melvin-bot bot added Weekly KSv2 and removed Daily KSv2 labels Jan 17, 2024
@bernhardoj
Copy link
Contributor

PR is ready

cc: @Santhosh-Sellavel

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Jan 19, 2024
@melvin-bot melvin-bot bot changed the title [$500] Split - Split scan with existing group members is created in both existing and new group chat [HOLD for payment 2024-01-26] [$500] Split - Split scan with existing group members is created in both existing and new group chat Jan 19, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Jan 19, 2024
Copy link

melvin-bot bot commented Jan 19, 2024

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

Copy link

melvin-bot bot commented Jan 19, 2024

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

If no regressions arise, payment will be issued on 2024-01-26. 🎊

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

Copy link

melvin-bot bot commented Jan 19, 2024

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:

  • [@Santhosh-Sellavel] The PR that introduced the bug has been identified. Link to the PR:
  • [@Santhosh-Sellavel] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
  • [@Santhosh-Sellavel] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
  • [@Santhosh-Sellavel] Determine if we should create a regression test for this bug.
  • [@Santhosh-Sellavel] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
  • [@isabelastisser] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@melvin-bot melvin-bot bot added the Overdue label Jan 29, 2024
@isabelastisser
Copy link
Contributor

Hey @Santhosh-Sellavel, can you please complete the checklist above? Thanks!

@isabelastisser
Copy link
Contributor

isabelastisser commented Jan 29, 2024

Payment summary:

@bernhardoj requires payment automatic offer (Contributor) $500 paid in Upwork.
@Santhosh-Sellavel requires payment through NewDot Manual Requests $500 PENDING PAYMENT IN NEWDOT.

@isabelastisser
Copy link
Contributor

Waiting for @Santhosh-Sellavel to complete the BZ list.

@isabelastisser
Copy link
Contributor

Bump @Santhosh-Sellavel

@isabelastisser
Copy link
Contributor

waiting for @Santhosh-Sellavel.

@isabelastisser
Copy link
Contributor

Bump @Santhosh-Sellavel, please let me know if I need to reassign this issue.

@Santhosh-Sellavel
Copy link
Collaborator

Santhosh-Sellavel commented Feb 2, 2024

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:

@Santhosh-Sellavel
Copy link
Collaborator

Bug:
Split scan with existing group members is created in both existing and new group chat

Regression Steps

  1. Create a new group chat with any user (if you don't have one)
  2. Create a split scan request from FAB with the participants from the group chat above
  3. Verify the request is added to the group chat above and not create a duplicate group chat
  4. Create a split scan request from the group chat composer add (+) button
  5. Verify the request is added to the group chat above and not create a duplicate group chat

@isabelastisser
Copy link
Contributor

Issue for regression test is created.

PENDING

@Santhosh-Sellavel requires payment through NewDot Manual Requests $500 PENDING PAYMENT IN NEWDOT.

@Santhosh-Sellavel
Copy link
Collaborator

Requested on ND

@JmillsExpensify
Copy link

$500 approved for @Santhosh-Sellavel based on summary above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Weekly KSv2
Projects
None yet
Development

No branches or pull requests

7 participants