fix: add report owner check when computing outstanding state of chat …#79893
Conversation
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.
|
563058b to
9823ea3
Compare
| return ( | ||
| canIOUBePaid(iouReport, chatReport, policy, bankAccountList, transactions) || | ||
| canApproveIOU(iouReport, policy, reportMetadata, transactions) || | ||
| canSubmitAndIsAwaitingForCurrentUser |
There was a problem hiding this comment.
Can we create new function - canSubmitAndIsAwaitingForCurrentUser and use it in both places?
We wanna avoid duplicated code.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7f82afc5ce
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| const shouldWaitForSubmission = shouldCurrentUserSubmitReport(iouReport, chatReport, policy, reportActions); | ||
| const canSubmitAndIsAwaitingForCurrentUser = | ||
| !hasAutoRejectedTransactionsForManager && | ||
| canSubmitReport(iouReport, policy, transactions, undefined, false, currentUserEmailParam, currentUserAccountIDParam) && | ||
| shouldWaitForSubmission; |
There was a problem hiding this comment.
Pass child report actions to reopened/retracted check
This call passes reportActions from the parent chat report into shouldCurrentUserSubmitReport, but that helper falls back to scanning actions when iouReport.hasReportBeenReopened/hasReportBeenRetracted is missing. For older reports or partial Onyx data where those flags aren’t set, the reopened/retracted action lives on the child IOU report, not the chat report. In that case shouldWaitForSubmission becomes false, so canSubmitAndIsAwaitingForCurrentUser won’t mark the child as outstanding and the submit state/GBR can disappear even though the report was retracted. Consider passing getAllReportActions(iouReportID) (or similar) instead of the chat report actions here.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
what do you think about this?
| import React, {useCallback, useContext, useDeferredValue, useEffect, useMemo, useRef, useState} from 'react'; | ||
| import {FlatList, View} from 'react-native'; | ||
| import type {ListRenderItemInfo, ViewToken} from 'react-native'; | ||
| import {FlatList, View} from 'react-native'; |
There was a problem hiding this comment.
There are some unnecessary changes like this.
| /** | ||
| * Determines if the current user should submit the report | ||
| */ | ||
| function shouldCurrentUserSubmitReport(iouReport: OnyxEntry<Report>, chatReport: OnyxEntry<Report>, policy: OnyxEntry<Policy>, reportActions?: OnyxEntry<ReportActions> | ReportAction[]) { |
There was a problem hiding this comment.
Please add unit test for this util function
…ract canSubmitAndIsAwaitingForCurrentUser
…ndIsAwaitingForCurrentUser
|
Took it over and resolved all the comments 🙏 |
|
@TMisiukiewicz please merge main. Conflicts! |
…atus-between-platforms-on-ws-reports
|
@aimane-chnaif done! |
|
job 5 still failing |
|
Codex Review: Didn't find any major issues. Breezy! ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
…atus-between-platforms-on-ws-reports
|
@aimane-chnaif should be good now 🙏 |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / Safariweb.mov |
|
Conflicts this time |
…atus-between-platforms-on-ws-reports
|
@aimane-chnaif resolved! |
|
Codex Review: Didn't find any major issues. 🚀 ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
…atus-between-platforms-on-ws-reports
…atus-between-platforms-on-ws-reports
|
🚧 @mountiny has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/mountiny in version: 9.3.33-0 🚀
|
|
🚀 Deployed to production by https://github.com/luacmartins in version: 9.3.33-5 🚀
|
Explanation of Change
Integrate the logic for displaying the Submit button as primary or secondary on a draft report from chat into the
hasOutstandingChildRequestfunction to avoid mistakenly displaying the GBR for the chat.Fixed Issues
$78881
PROPOSAL:
Initial proposal
Tests
Offline tests
Same as tests
QA Steps
Same as tests
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
Screen.Recording.2026-02-04.at.15.19.45.mov
Android: mWeb Chrome
iOS: Native
Screen.Recording.2026-02-04.at.15.21.45.mov
iOS: mWeb Safari
MacOS: Chrome / Safari
Screen.Recording.2026-02-04.at.14.46.47.mov