-
Notifications
You must be signed in to change notification settings - Fork 3k
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
feat: [Auth Violations] Support isDismissed on newDot to hide violations. #54455
Open
Krishna2323
wants to merge
26
commits into
Expensify:main
Choose a base branch
from
Krishna2323:krishna2323/issue/53398
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
6463ecf
feat: [Auth Violations] Support isDismissed on newDot to hide violati…
Krishna2323 6166bb7
Merge branch 'main' into krishna2323/issue/53398
Krishna2323 2a179a2
fix eslint.
Krishna2323 cd59a56
fix eslint.
Krishna2323 5682ae0
fix eslint.
Krishna2323 1016065
fix eslint.
Krishna2323 a2d0da6
fix ESLint.
Krishna2323 ee414e3
fix ESLint.
Krishna2323 82877a6
Merge branch 'Expensify:main' into krishna2323/issue/53398
Krishna2323 18f9c6f
fix ESlint issues.
Krishna2323 40c5559
fix ESlint issues.
Krishna2323 3f4dd02
Merge branch 'main' into krishna2323/issue/53398
Krishna2323 7eb5639
Merge branch 'Expensify:main' into krishna2323/issue/53398
Krishna2323 593f497
fix ESlint.
Krishna2323 825c4be
fix ESlint.
Krishna2323 969623b
Merge branch 'main' into krishna2323/issue/53398
Krishna2323 486acb5
revert unnecessary changes.
Krishna2323 0a0cbc3
fix ESLint.
Krishna2323 55f73fa
fix ESLint.
Krishna2323 a5194c8
minor update.
Krishna2323 332efdf
fix merge conflicts.
Krishna2323 1ef4be5
minor import fix.
Krishna2323 afe362c
Merge branch 'main' into krishna2323/issue/53398
Krishna2323 6abedea
remove duplicate imports.
Krishna2323 05747b2
minor fix.
Krishna2323 d870956
fix typescript issue.
Krishna2323 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
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 |
---|---|---|
|
@@ -110,7 +110,8 @@ function MoneyRequestPreviewContent({ | |
const transactionID = isMoneyRequestAction ? getOriginalMessage(action)?.IOUTransactionID : undefined; | ||
const [transaction] = useOnyx(`${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`); | ||
const [walletTerms] = useOnyx(ONYXKEYS.WALLET_TERMS); | ||
const [transactionViolations] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS); | ||
const [allViolations] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS); | ||
const transactionViolations = getTransactionViolations(transaction?.transactionID); | ||
|
||
const sessionAccountID = session?.accountID; | ||
const managerID = iouReport?.managerID ?? CONST.DEFAULT_NUMBER_ID; | ||
|
@@ -143,9 +144,9 @@ function MoneyRequestPreviewContent({ | |
const isOnHold = isOnHoldTransactionUtils(transaction); | ||
const isSettlementOrApprovalPartial = !!iouReport?.pendingFields?.partial; | ||
const isPartialHold = isSettlementOrApprovalPartial && isOnHold; | ||
const hasViolations = hasViolationTransactionUtils(transaction?.transactionID, transactionViolations, true); | ||
const hasNoticeTypeViolations = hasNoticeTypeViolationTransactionUtils(transaction?.transactionID, transactionViolations, true) && isPaidGroupPolicy(iouReport); | ||
const hasWarningTypeViolations = hasWarningTypeViolationTransactionUtils(transaction?.transactionID, transactionViolations, true); | ||
const hasViolations = hasViolationTransactionUtils(transaction?.transactionID, allViolations, true); | ||
const hasNoticeTypeViolations = hasNoticeTypeViolationTransactionUtils(transaction?.transactionID, allViolations, true) && isPaidGroupPolicy(iouReport); | ||
const hasWarningTypeViolations = hasWarningTypeViolationTransactionUtils(transaction?.transactionID, allViolations, true); | ||
const hasFieldErrors = hasMissingSmartscanFields(transaction); | ||
const isDistanceRequest = isDistanceRequestTransactionUtils(transaction); | ||
const isFetchingWaypointsFromServer = isFetchingWaypointsFromServerTransactionUtils(transaction); | ||
|
@@ -160,11 +161,8 @@ function MoneyRequestPreviewContent({ | |
|
||
// Get transaction violations for given transaction id from onyx, find duplicated transactions violations and get duplicates | ||
const allDuplicates = useMemo( | ||
() => | ||
transactionViolations?.[`${ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS}${transaction?.transactionID}`]?.find( | ||
(violation) => violation.name === CONST.VIOLATIONS.DUPLICATED_TRANSACTION, | ||
)?.data?.duplicates ?? [], | ||
[transaction?.transactionID, transactionViolations], | ||
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. Don't we have to keep |
||
() => transactionViolations?.find((violation) => violation.name === CONST.VIOLATIONS.DUPLICATED_TRANSACTION)?.data?.duplicates ?? [], | ||
[transactionViolations], | ||
); | ||
|
||
// Remove settled transactions from duplicates | ||
|
@@ -235,7 +233,7 @@ function MoneyRequestPreviewContent({ | |
} | ||
|
||
if (shouldShowRBR && transaction) { | ||
const violations = getTransactionViolations(transaction.transactionID, transactionViolations); | ||
const violations = getTransactionViolations(transaction.transactionID); | ||
if (shouldShowHoldMessage) { | ||
return `${message} ${CONST.DOT_SEPARATOR} ${translate('violations.hold')}`; | ||
} | ||
|
@@ -282,7 +280,7 @@ function MoneyRequestPreviewContent({ | |
if (shouldShowBrokenConnectionViolation(transaction ? [transaction.transactionID] : [], iouReport, policy)) { | ||
return {shouldShow: true, messageIcon: Expensicons.Hourglass, messageDescription: translate('violations.brokenConnection530Error')}; | ||
} | ||
if (hasPendingUI(transaction, getTransactionViolations(transaction?.transactionID, transactionViolations))) { | ||
if (hasPendingUI(transaction, getTransactionViolations(transaction?.transactionID))) { | ||
return {shouldShow: true, messageIcon: Expensicons.Hourglass, messageDescription: translate('iou.pendingMatchWithCreditCard')}; | ||
} | ||
return {shouldShow: false}; | ||
|
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.
Let us use
||
instead of??
as that will help address empty strings as well.