Fix: Multi-level tags show "Required" on all levels when only some are required - #98247
Fix: Multi-level tags show "Required" on all levels when only some are required#98247MelvinBot wants to merge 1 commit into
Conversation
Co-authored-by: huult <huult@users.noreply.github.com>
|
The failing build check is unrelated to this PR — it's an iOS CocoaPods infrastructure error, not something these changes caused. No code fix is needed; the build just needs to be re-run. Analysis: The This is a transient failure fetching the prebuilt Evidence it's unrelated: This PR only changes two TypeScript files — The other two red checks are the standard Recommendation: Re-run the failed iOS build job — this class of |
|
No new failure here — the situation is unchanged from my previous comment, and the picture is now even clearer. Since then, all the code checks that were pending have completed and passed: all 8 The only red check that's an actual failure is still Recommendation: Re-run the failed iOS build job. The remaining two red marks ( |
Explanation of Change
On a workspace using independent multi-level tags, the create-expense confirmation screen labeled every tag level "Required" whenever the workspace-wide
requiresTagflag was on — even levels whose ownrequiredflag isfalse. The badge was purely cosmetic: validation only blocks submission on the levels that are actually required, so the "Required" label disagreed with what the app enforces. Classic Expensify labels only the truly-required level.The root cause is that the badge and the tag validation used two different rules for multi-level tags:
getTagVisibilityinTagsOptionsListUtils.ts) computedisTagRequired = required || !!policy?.requiresTagper tag list. OR-ing in the aggregatepolicy.requiresTagmeant that once it was truthy, every level was labeled "Required" regardless of its ownrequiredvalue.getTagViolationsForMultiLevelTagsinViolationsUtils.ts) flags a level only when that level's ownrequiredis set (policyTagList[key].required ?? true), so only the truly-required level blocks submission.This change makes the badge mirror the per-level validation for multi-level tags: for multi-level policies
isTagRequiredis nowrequired ?? true(the same rule validation uses), while single-level policies keep the existingrequired || !!policy?.requiresTagbehavior (their per-listrequiredmay be unset, sopolicy.requiresTagis what makes the single level required). Added a unit test covering an independent three-level policy where only the first level is required.Fixed Issues
$ #98232
PROPOSAL: #98232 (comment)
Tests
// TODO: The human co-author must fill out the tests you ran before marking this PR as "ready for review". Please describe what tests you performed that validate your change worked.
Suggested steps:
Offline tests
QA Steps
// TODO: These must be filled out, or the issue title must include "[No QA]."
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari