-
Notifications
You must be signed in to change notification settings - Fork 4k
Allow rejecting expenses in bulk in NewDot #72855
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
Merged
Merged
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
898daaf
add reject to bulk action types
lakchote dfde406
add reject reason route and navigation config
lakchote 6622395
add reject translations for all languages
lakchote 6845dee
add per-transaction loading helpers for bulk reject
lakchote a2d377b
implement client-side bulk reject loop
lakchote a2256be
create search reject reason page
lakchote 60e4f4b
wire reject action to search page bulk menu
lakchote 7f5a7f9
fixes
lakchote a9a4e6a
fix translations
lakchote 1c7e6c1
make translation multi-line
lakchote 48d9243
add comment
lakchote c32f729
remove unneeded check
lakchote b29db8b
put back the default value for `backTo`
lakchote 65728a4
Merge branch 'main' into lucien/reject-bulk-action
lakchote c86f623
change `shouldShowRejectOption` condition
lakchote bf36580
`sharedRejectedToReportID` logic
lakchote 6b99310
pass down the `sharedRejectedToReportID` when rejecting in bulk
lakchote e104d44
fix style
lakchote 82e6486
Merge branch 'main' into lucien/reject-bulk-action
lakchote 9a4e122
fix lint
lakchote 1f3238e
Merge branch 'main' into lucien/reject-bulk-action
lakchote e8552ea
remove redundant condition
lakchote de40181
remove `backTo`
lakchote c4d16a0
fix lint
lakchote 2aaf9e3
fix bug
lakchote e79e1ef
fix lint
lakchote 66218a2
fix style
lakchote File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,6 +25,7 @@ import type {OptimisticExportIntegrationAction} from '@libs/ReportUtils'; | |
| import { | ||
| buildOptimisticExportIntegrationAction, | ||
| buildOptimisticIOUReportAction, | ||
| generateReportID, | ||
| getReportTransactions, | ||
| hasHeldExpenses, | ||
| isExpenseReport, | ||
|
|
@@ -47,6 +48,7 @@ import type {SearchPolicy, SearchReport, SearchTransaction} from '@src/types/ony | |
| import type Nullable from '@src/types/utils/Nullable'; | ||
| import SafeString from '@src/utils/SafeString'; | ||
| import {setPersonalBankAccountContinueKYCOnSuccess} from './BankAccounts'; | ||
| import {rejectMoneyRequest} from './IOU'; | ||
| import {setOptimisticTransactionThread} from './Report'; | ||
| import {saveLastSearchParams} from './ReportNavigation'; | ||
|
|
||
|
|
@@ -580,6 +582,29 @@ function unholdMoneyRequestOnSearch(hash: number, transactionIDList: string[]) { | |
| API.write(WRITE_COMMANDS.UNHOLD_MONEY_REQUEST_ON_SEARCH, {hash, transactionIDList}, {optimisticData, finallyData}); | ||
| } | ||
|
|
||
| function rejectMoneyRequestsOnSearch(hash: number, selectedTransactions: SelectedTransactions, comment: string) { | ||
|
luacmartins marked this conversation as resolved.
|
||
| const transactionIDs = Object.keys(selectedTransactions); | ||
|
|
||
| const transactionsByReport: Record<string, string[]> = {}; | ||
|
luacmartins marked this conversation as resolved.
|
||
| transactionIDs.forEach((transactionID) => { | ||
|
luacmartins marked this conversation as resolved.
|
||
| const reportID = selectedTransactions[transactionID].reportID; | ||
| if (!transactionsByReport[reportID]) { | ||
| transactionsByReport[reportID] = []; | ||
| } | ||
| transactionsByReport[reportID].push(transactionID); | ||
| }); | ||
|
|
||
| Object.entries(transactionsByReport).forEach(([reportID, reportTransactionIDs]) => { | ||
|
luacmartins marked this conversation as resolved.
luacmartins marked this conversation as resolved.
|
||
| // Share a single destination ID across all rejections from the same source report | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ❌ JSDoc Comments (docs)Missing JSDoc documentation for the /**
* Reject multiple money requests from search results in bulk
* @param hash - The search query hash
* @param selectedTransactions - Map of selected transactions with their metadata
* @param comment - The rejection reason comment
*/
function rejectMoneyRequestsOnSearch(hash: number, selectedTransactions: SelectedTransactions, comment: string) { |
||
| const sharedRejectedToReportID = generateReportID(); | ||
| reportTransactionIDs.forEach((transactionID) => { | ||
| rejectMoneyRequest(transactionID, reportID, comment, {sharedRejectedToReportID}); | ||
| }); | ||
|
luacmartins marked this conversation as resolved.
|
||
| }); | ||
|
lakchote marked this conversation as resolved.
|
||
|
|
||
| playSound(SOUNDS.SUCCESS); | ||
| } | ||
|
|
||
| function deleteMoneyRequestOnSearch(hash: number, transactionIDList: string[]) { | ||
| const {optimisticData: loadingOptimisticData, finallyData} = getOnyxLoadingData(hash); | ||
| const optimisticData: OnyxUpdate[] = [ | ||
|
|
@@ -956,6 +981,7 @@ export { | |
| deleteMoneyRequestOnSearch, | ||
| holdMoneyRequestOnSearch, | ||
| unholdMoneyRequestOnSearch, | ||
| rejectMoneyRequestsOnSearch, | ||
| exportSearchItemsToCSV, | ||
| queueExportSearchItemsToCSV, | ||
| queueExportSearchWithTemplate, | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.