fix: Group split - The split amount is editable in the participant's chat, leads to unexpected error#83136
fix: Group split - The split amount is editable in the participant's chat, leads to unexpected error#83136annaweber830 wants to merge 1 commit intoExpensify:mainfrom
Conversation
|
@abdulrahuman5196 Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
Codecov Report❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.
|
| const canEditAmount = | ||
| !isGPSDistanceRequest && | ||
| isEditable && | ||
| !isBillSplit && |
There was a problem hiding this comment.
❌ CONSISTENCY-3 (docs)
The !isBillSplit && guard is duplicated across 5 separate canEdit* variables (canEditAmount, canEditMerchant, canEditDate, canEditDistance, canEditDistanceRate). This same condition could be centralized inside canEditFieldOfMoneyRequest in src/libs/ReportUtils.ts, which already receives the transaction via linkedTransaction. Scattering the guard at call sites means any new caller of canEditFieldOfMoneyRequest won't benefit from this restriction, and any new canEdit* variable in this file must remember to add the guard.
Consider adding the isBillSplit check inside canEditFieldOfMoneyRequest for the relevant restricted fields (amount, merchant, date, distance, distance_rate), so it is enforced centrally:
// Inside canEditFieldOfMoneyRequest, after getting the transaction:
const {isBillSplit} = getOriginalTransactionWithSplitInfo(transaction);
if (isBillSplit && restrictedFields.includes(fieldToEdit)) {
return false;
}This removes the need for 5 repeated !isBillSplit && checks at the call site and the redundant isBillSplit early return in the onPress handler.
Please rate this suggestion with 👍 or 👎 to help us improve! Reactions are used to monitor reviewer efficiency.
Explanation of Change
fix: Group split - The split amount is editable in the participant's chat, leads to unexpected error
Fixed Issues
$ #80033
PROPOSAL: #80033 (comment)
Tests
Offline tests
Same as tests
QA Steps
// TODO: These must be filled out, or the issue title must include "[No QA]."
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, 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.ScrollViewcomponent to make it scrollable when more elements are added to the page.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
Screen.Recording.2026-02-21.at.7.20.46.AM.mp4