-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Description
Part of the Merge Duplicates project
Main issue: https://github.com/Expensify/Expensify/issues/307591
Doc section: Surfacing Potential Duplicates
Project: [Wave: Collect Approvers] Dupe Detection
Part of a series of issues:
- [HOLD for payment 2024-07-10] [HOLD for payment 2024-07-02] [Dupe Detection] Merge Duplicates - Review Page #39756
- [HOLD for payment 2024-07-22] [HOLD for payment 2024-07-17] [Dupe Detection] Merge Duplicates - Review Fields Page #39808
- [Hold for payment 2024-07-31] [Dupe Detection] Merge Duplicates - Confirm Page #39810
Feature Description
Context for ReviewDuplicates
- Review page - /r/:threadReportID/duplicates/review
- Merchant - /r/:threadReportID/duplicates/review/merchant
- Category - /r/:threadReportID/duplicates/review/category
- Tag - /r/:threadReportID/duplicates/review/tag
- Description - /r/:threadReportID/duplicates/review/description
- Confirm page - /r/:threadReportID/duplicates/confirm
All of these screens will exist in their own navigator so they can be pushed (and later popped off once complete) as a group.
All of this will use an Onyx form key of ONYXKEYS.FORMS.REVIEW_DUPLICATES_FORM so we can store the data selected by the user so far when resolving the duplicates. It also lets us keep track of which transaction to keep and which ones are duplicates when the user clicks on Keep this one.
This key will follow a structure like this:
{
"review_duplicates_form_<transactionID>": [
{
"duplicates": {
<transactionID>: <transactionID>,
...
},
"merchant": "...",
"tag": ...",
"description": ...",
…
}
]
}
Confirm Page
Our last confirm page will show a similar non-editable version of MoneyRequestView:
- Enable shouldShowOfflineIndicator for the screenwrapper as the command only works online.
- This view is also a form component but features a green “Confirm” button.
- onPress, we call an action in actions/IOU.js called mergeDuplicates which calls:
API.write('MergeDuplicates',
{
transactionID, // transaction to keep
transactionIDs, // transactions to delete
created,
merchant,
...
}:
Some notes about the above request:
-
Since we are using pattern B, we need to set the optimistic and failure data. When we merge two or more transactions, we basically need to get rid of the ones that we don’t want to keep and update the one that we want to keep.
- Removing the ones that we don’t want to keep works similarly to when we delete a money request, so we will update Onyx data really similarly to what we do here.
- Additionally, we need to update the
transactions_
key in Onyx with the updated fields (merchant, tags, category…) for the transactionID. - We also need to update the comment in the
transactions_
key in Onyx to remove the duplicate violation violation within the comment. - We also need to update the
transactionViolations_
key in Onyx to remove the duplicate violation. We’ll update theViolationUtils.getViolationsOnyxData
method that calculates the new transaction violations (by adding/removing those that have been addressed with the current user changes), and returns an object that we can save into Onyx, to work with duplicate violations as well.
-
We will navigate the user directly back to the MoneyRequestView of the expenseReport we were keeping.
Issue Owner
Current Issue Owner: @kubabutkiewiczMetadata
Metadata
Labels
Type
Projects
Status