-
Notifications
You must be signed in to change notification settings - Fork 3.7k
feat: add ability to require attendees based on category selection (rework) #79050
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
JS00001
merged 20 commits into
Expensify:main
from
ikevin127:ikevin127-categoryRequireAttendeesRework
Jan 14, 2026
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
62314b5
feat: add ability to require attendees based on category selection
ikevin127 9509674
fix: 79003 - app crashes after removing expense from report
ikevin127 97d5baf
fix: 79007 - violation appears twice
ikevin127 8de058d
fix: 79008 - invoice cannot be sent when user selects a category that…
ikevin127 7c8a863
fix: 79011 - no attendee require violation on confirm page when there…
ikevin127 5e6c0a5
fix: 79011 - additional follow-up
ikevin127 4e8a274
fix: 79013 - violation for required attendee disappears after opening…
ikevin127 452b3bb
fix: 79017 - violation does not show up on expense row when additiona…
ikevin127 f67c42e
Merge branch 'main' of https://github.com/Expensify/App into ikevin12…
ikevin127 1bba24d
resolve submodule - ready for review
ikevin127 cf2e0fb
fix: typecheck
ikevin127 c869695
Merge branch 'main' of https://github.com/Expensify/App into ikevin12…
ikevin127 586e011
chore: resolve submodule
ikevin127 8f17f9e
fix: corrected getCurrentUserEmail import and eslint
ikevin127 30dce16
Merge branch 'main' of https://github.com/Expensify/App into ikevin12…
ikevin127 3c44ad3
fix: adjusted missingAttendees violation clearing logic
ikevin127 d5c78e7
chore: submodule sync
ikevin127 c6c68e0
Merge branch 'main' of https://github.com/Expensify/App into ikevin12…
ikevin127 29da283
chore: submodule sync
ikevin127 f8f7196
fix: added OnyxData argument and fixed spellcheck - ready to merge
ikevin127 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,6 +30,7 @@ import { | |
| setMoneyRequestTaxRate, | ||
| setSplitShares, | ||
| } from '@libs/actions/IOU'; | ||
| import {getIsMissingAttendeesViolation} from '@libs/AttendeeUtils'; | ||
| import {isCategoryDescriptionRequired} from '@libs/CategoryUtils'; | ||
| import {convertToBackendAmount, convertToDisplayString, convertToDisplayStringWithoutCurrency, getCurrencyDecimals} from '@libs/CurrencyUtils'; | ||
| import DistanceRequestUtils from '@libs/DistanceRequestUtils'; | ||
|
|
@@ -433,11 +434,20 @@ function MoneyRequestConfirmationList({ | |
| setFormError('iou.receiptScanningFailed'); | ||
| return; | ||
| } | ||
| // reset the form error whenever the screen gains or loses focus | ||
| setFormError(''); | ||
|
|
||
| // Reset the form error whenever the screen gains or loses focus | ||
| // but preserve violation-related errors since those represent real validation issues | ||
| // that can only be fixed by changing the underlying data | ||
| if (!formError.startsWith(CONST.VIOLATIONS_PREFIX)) { | ||
| setFormError(''); | ||
| return; | ||
| } | ||
| // Clear missingAttendees violation if user fixed it by changing category or attendees | ||
| const isMissingAttendeesViolation = getIsMissingAttendeesViolation(policyCategories, iouCategory, iouAttendees, currentUserPersonalDetails, policy?.isAttendeeTrackingEnabled); | ||
| if (formError === 'violations.missingAttendees' && !isMissingAttendeesViolation) { | ||
| setFormError(''); | ||
| } | ||
|
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. reverting the above change fixed the problem with the persistent error #79902 |
||
| // eslint-disable-next-line react-hooks/exhaustive-deps -- we don't want this effect to run if it's just setFormError that changes | ||
| }, [isFocused, shouldDisplayFieldError, hasSmartScanFailed, didConfirmSplit]); | ||
| }, [isFocused, shouldDisplayFieldError, hasSmartScanFailed, didConfirmSplit, iouCategory, iouAttendees, policyCategories, currentUserPersonalDetails, policy?.isAttendeeTrackingEnabled]); | ||
|
|
||
| useEffect(() => { | ||
| // We want this effect to run only when the transaction is moving from Self DM to a expense chat | ||
|
|
@@ -928,6 +938,15 @@ function MoneyRequestConfirmationList({ | |
| return; | ||
| } | ||
|
|
||
| // Since invoices are not expense reports that need attendee tracking, this validation should not apply to invoices | ||
| const isMissingAttendeesViolation = | ||
| iouType !== CONST.IOU.TYPE.INVOICE && | ||
| getIsMissingAttendeesViolation(policyCategories, iouCategory, iouAttendees, currentUserPersonalDetails, policy?.isAttendeeTrackingEnabled); | ||
| if (isMissingAttendeesViolation) { | ||
| setFormError('violations.missingAttendees'); | ||
| return; | ||
| } | ||
|
|
||
| if (isPerDiemRequest && (transaction.comment?.customUnit?.subRates ?? []).length === 0) { | ||
| setFormError('iou.error.invalidSubrateLength'); | ||
| return; | ||
|
|
@@ -1001,6 +1020,8 @@ function MoneyRequestConfirmationList({ | |
| showDelegateNoAccessModal, | ||
| iouCategory, | ||
| policyCategories, | ||
| iouAttendees, | ||
| currentUserPersonalDetails, | ||
| ], | ||
| ); | ||
|
|
||
|
|
@@ -1024,6 +1045,10 @@ function MoneyRequestConfirmationList({ | |
| if (isTypeSplit && !shouldShowReadOnlySplits) { | ||
| return debouncedFormError && translate(debouncedFormError); | ||
| } | ||
| // Don't show error at the bottom of the form for missing attendees | ||
| if (formError === 'violations.missingAttendees') { | ||
| return; | ||
| } | ||
| return formError && translate(formError); | ||
| }, [routeError, isTypeSplit, shouldShowReadOnlySplits, debouncedFormError, formError, translate]); | ||
|
|
||
|
|
||
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
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.
NAB: Is the trailing period in VIOLATIONS_PREFIX intentional?
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.
Yes, it was either adding it in component like
'${CONST. VIOLATIONS_PREFIX}.'or having it include the dot as part of the constant - this made more sense at the time 😃