-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
fix: Use new ResolveDuplicates when approver is resolving duplicates #48522
Merged
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
36b7e06
fix: Use new ResolveDuplicates when approver is resolving duplicates
nkdengineer 2d1d4ca
add new api params
nkdengineer 6325f73
Merge branch 'main' into fix/48416
nkdengineer 8086b11
complete parameter for API
nkdengineer 06bdd10
Merge branch 'main' into fix/48416
nkdengineer 107be8e
fix the order issue
nkdengineer c5023dc
fix lint
nkdengineer e881a3b
Merge branch 'main' into fix/48416
nkdengineer b549c50
merge main
nkdengineer 96d0da4
create a util to get iou action
nkdengineer 754932d
rename variable
nkdengineer b7a27c3
fix lint
nkdengineer b331032
use getIOUActionForTransactions
nkdengineer 85cc2e9
merge main
nkdengineer 5fcf063
remove unuse variable
nkdengineer f56ffab
Update src/libs/API/parameters/ResolveDuplicatesParams.ts
nkdengineer c076bdc
Merge branch 'main' into fix/48416
nkdengineer aee9154
fix lint
nkdengineer 0ba5ac8
Merge branch 'main' into fix/48416
nkdengineer c776014
update param
nkdengineer 46c75e1
Merge branch 'main' into fix/48416
nkdengineer e32ed93
Merge branch 'main' into fix/48416
nkdengineer 98287b6
fix native bug
nkdengineer 23e2313
Update src/libs/actions/IOU.ts
nkdengineer b3cce2d
Merge branch 'main' into fix/48416
nkdengineer 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 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
36 changes: 5 additions & 31 deletions
36
src/components/ReportActionItem/MoneyRequestPreview/index.tsx
This file contains 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 |
---|---|---|
@@ -1,44 +1,18 @@ | ||
import lodashIsEmpty from 'lodash/isEmpty'; | ||
import React from 'react'; | ||
import {withOnyx} from 'react-native-onyx'; | ||
import * as ReportActionsUtils from '@libs/ReportActionsUtils'; | ||
import {useOnyx} from 'react-native-onyx'; | ||
import ONYXKEYS from '@src/ONYXKEYS'; | ||
import MoneyRequestPreviewContent from './MoneyRequestPreviewContent'; | ||
import type {MoneyRequestPreviewOnyxProps, MoneyRequestPreviewProps} from './types'; | ||
import type {MoneyRequestPreviewProps} from './types'; | ||
|
||
function MoneyRequestPreview(props: MoneyRequestPreviewProps) { | ||
const [iouReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${props.iouReportID || '-1'}`); | ||
// We should not render the component if there is no iouReport and it's not a split or track expense. | ||
// Moved outside of the component scope to allow for easier use of hooks in the main component. | ||
// eslint-disable-next-line react/jsx-props-no-spreading | ||
return lodashIsEmpty(props.iouReport) && !(props.isBillSplit || props.isTrackExpense) ? null : <MoneyRequestPreviewContent {...props} />; | ||
return lodashIsEmpty(iouReport) && !(props.isBillSplit || props.isTrackExpense) ? null : <MoneyRequestPreviewContent {...props} />; | ||
} | ||
|
||
MoneyRequestPreview.displayName = 'MoneyRequestPreview'; | ||
|
||
export default withOnyx<MoneyRequestPreviewProps, MoneyRequestPreviewOnyxProps>({ | ||
personalDetails: { | ||
key: ONYXKEYS.PERSONAL_DETAILS_LIST, | ||
}, | ||
chatReport: { | ||
key: ({chatReportID}) => `${ONYXKEYS.COLLECTION.REPORT}${chatReportID}`, | ||
}, | ||
iouReport: { | ||
key: ({iouReportID}) => `${ONYXKEYS.COLLECTION.REPORT}${iouReportID}`, | ||
}, | ||
session: { | ||
key: ONYXKEYS.SESSION, | ||
}, | ||
transaction: { | ||
key: ({action}) => { | ||
const isMoneyRequestAction = ReportActionsUtils.isMoneyRequestAction(action); | ||
const transactionID = isMoneyRequestAction ? ReportActionsUtils.getOriginalMessage(action)?.IOUTransactionID : 0; | ||
return `${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`; | ||
}, | ||
}, | ||
walletTerms: { | ||
key: ONYXKEYS.WALLET_TERMS, | ||
}, | ||
transactionViolations: { | ||
key: ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS, | ||
}, | ||
})(MoneyRequestPreview); | ||
export default MoneyRequestPreview; |
This file contains 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 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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
type ResolveDuplicatesParams = { | ||
/** The ID of the transaction that we want to keep */ | ||
transactionID: string; | ||
|
||
/** The list of other duplicated transactions */ | ||
transactionIDList: string[]; | ||
created: string; | ||
merchant: string; | ||
amount: number; | ||
currency: string; | ||
category: string; | ||
comment: string; | ||
billable: boolean; | ||
reimbursable: boolean; | ||
tag: string; | ||
|
||
/** The reportActionID of the dismissed violation action in the kept transaction thread report */ | ||
dismissedViolationReportActionID: string; | ||
|
||
/** The ID list of the hold report actions corresponding to the transactionIDList */ | ||
reportActionIDList: string[]; | ||
}; | ||
|
||
export default ResolveDuplicatesParams; |
This file contains 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 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 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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did we move these here instead of MoneyRequestPreview?