Repository navigation
Hide automatic TAKE_CONTROL actions from OldDot auto-pay workflow - #84525
Conversation
When OldDot auto-pays a report, it creates a TAKECONTROL action as a side effect of reassigning the report manager. This action has automaticAction: true in its originalMessage. NewDot was unconditionally rendering it as "changed the approver to [owner name]". Add automaticAction to OriginalMessageTakeControl type and check it in shouldReportActionBeVisible to hide auto-pay TAKE_CONTROL actions while preserving manual take-control messages (which lack automaticAction). Co-authored-by: Linh Vo <linhvovan29546@users.noreply.github.com>
…flag For OldDot TAKE_CONTROL actions that may not have automaticAction set, add a fallback heuristic: hide when the actor is the report owner AND the report is in AUTOREIMBURSED state. This combination indicates the TAKE_CONTROL was a side effect of auto-pay, not a manual approver change. Co-authored-by: Linh Vo <linhvovan29546@users.noreply.github.com>
|
@MelvinBot Remove the second condition https://github.com/Expensify/App/pull/84525/changes#diff-b8041d6cb129cc7b8a6223f8ffa570e79c326d8ea4affbad35c33cf6c8ea660dR1162-R1167. For the first condition plase add the check for mentionedAccountIDs |
Per review feedback: - Removed the fallback condition that checked report owner and AUTOREIMBURSED state - Added mentionedAccountIDs check to the primary condition alongside automaticAction Co-authored-by: Linh Vo <linhvovan29546@users.noreply.github.com>
|
Updated per your feedback:
The updated condition in if (
takeControlOriginalMessage &&
'automaticAction' in takeControlOriginalMessage &&
takeControlOriginalMessage.automaticAction &&
reportAction.actorAccountID &&
takeControlOriginalMessage.mentionedAccountIDs?.includes(reportAction.actorAccountID)
) {
return false;
} |
…leakage The APPROVED action test leaves automaticAction: true in originalMessage via Onyx deep merge. When the TAKE_CONTROL test runs after, this leaked property triggers the new automaticAction visibility check, hiding the action and causing the test to expect non-empty text but receive "". Switch to Onyx.set to replace (not merge) the report actions collection, ensuring each test starts with clean data. Co-authored-by: Linh Vo <linhvovan29546@users.noreply.github.com>
…com/Expensify/App into claude-hideAutoPayTakeControlAction Co-authored-by: Linh Vo <linhvovan29546@users.noreply.github.com>
| if ( | ||
| takeControlOriginalMessage && | ||
| 'automaticAction' in takeControlOriginalMessage && | ||
| takeControlOriginalMessage.automaticAction && | ||
| reportAction.actorAccountID && | ||
| takeControlOriginalMessage.mentionedAccountIDs?.includes(reportAction.actorAccountID) | ||
| ) { | ||
| return false; | ||
| } |
There was a problem hiding this comment.
| if ( | |
| takeControlOriginalMessage && | |
| 'automaticAction' in takeControlOriginalMessage && | |
| takeControlOriginalMessage.automaticAction && | |
| reportAction.actorAccountID && | |
| takeControlOriginalMessage.mentionedAccountIDs?.includes(reportAction.actorAccountID) | |
| ) { | |
| return false; | |
| } | |
| const originalMessage = getOriginalMessage(reportAction as ReportAction<typeof CONST.REPORT.ACTIONS.TYPE.TAKE_CONTROL>); | |
| if (originalMessage?.automaticAction && !originalMessage?.mentionedAccountIDs?.length) { | |
| return false; | |
| } |
There was a problem hiding this comment.
Applied your suggestion and added 4 unit tests:
automaticAction: true+ emptymentionedAccountIDs→ hiddenautomaticAction: true+ non-emptymentionedAccountIDs→ visibleautomaticAction: false→ visibleautomaticActionnot set → visible
All tests pass.
|
Fixed the failing Root cause: The Fix: Changed Note: The concurrent commit |
|
@MelvinBot Please apply this suggestion: #84525 (comment). And add unit tests |
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
- Simplified TAKE_CONTROL visibility condition per review suggestion: hide when automaticAction is true and mentionedAccountIDs is empty - Added 4 unit tests covering TAKE_CONTROL visibility scenarios Co-authored-by: Linh Vo <linhvovan29546@users.noreply.github.com>
…echeck The OriginalMessageTakeControl type is defined in both OriginalMessage.ts and OldDotAction.ts with incompatible structures. Their intersection in OriginalMessageMap requires properties from both types simultaneously. Using type assertions (matching the established test pattern) avoids this type conflict while keeping the test logic intact. Co-authored-by: Linh Vo <linhvovan29546@users.noreply.github.com>
|
Fixed the failing Changed the test objects to use |
|
The only failing check is To resolve the checklist failure, the PR author or reviewer needs to complete the checklist items in the PR description. |
|
@MelvinBot The |
|
Updated the Explanation of Change section to reflect the current implementation — it now describes the single condition that checks both |
|
@MelvinBot Mark this PR |
|
@linhvovan29546 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] |
|
Marked this PR as Ready for review as requested. |
trjExpensify
left a comment
There was a problem hiding this comment.
Make sure you add videos and what not to confirm this is working correctly 👍
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppScreen.Recording.2026-03-09.at.22.34.39.movAndroid: mWeb ChromeScreen.Recording.2026-03-09.at.22.32.26.moviOS: HybridAppScreen.Recording.2026-03-09.at.22.26.57.moviOS: mWeb SafariScreen.Recording.2026-03-09.at.22.24.07.movMacOS: Chrome / SafariBeforeScreen.Recording.2026-03-09.at.22.30.48.movAfter Screen.Recording.2026-03-09.at.22.21.26.mov |
|
We did not find an internal engineer to review this PR, trying to assign a random engineer to #84288 as well as to this PR... Please reach out for help on Slack if no one gets assigned! |
@trjExpensify You can take a look at the |
|
@linhvovan29546 the videos are not from an auto pay workflow, are they? |
They come from the auto pay workflow. |
|
Why they show up as approved/outstanding instead of paid though? 😕 |
|
I used a test bank, so the auto pay did not succeed. |
|
But i still have the TAKE_CONTROL action correct, same as the OP. |
|
Ah that makes sense, thanks! I was trying to match the video from applause to this one 😄 |
|
@trjExpensify are you reviewing this one too? |
|
That is a good question. OldDot hides it in PHP by checking if The fix in this branch seems to be the way we have been hiding actions in NewDot though. |
Gotcha. So the reportAction has traditionally still been recorded in the database in Classic, just hidden in PHP. That was my concern really, that we traditionally skipped creating this reportAction in the auto-pay case but are now storing it (and opting to hide it) with the NewDot case. 👍 |
|
Yep it is still generated in OldDot |
|
🚧 @rlinoz 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/rlinoz in version: 9.3.35-0 🚀
|
|
🚀 Deployed to production by https://github.com/luacmartins in version: 9.3.35-1 🚀
|

Explanation of Change
When a report is created and approved in OldDot with auto-pay enabled, NewDot displays an extra "Changed approver [owner name]" system message that shouldn't be there. This happens because OldDot's auto-pay workflow creates a
TAKECONTROLreport action as a side effect of reassigning the report manager during auto-reimbursement, and NewDot unconditionally renders it as a visible "changed the approver to [owner name]" message.This PR adds a check in
shouldReportActionBeVisibleto hide these auto-payTAKE_CONTROLactions: if the action'soriginalMessagehasautomaticAction: trueand itsmentionedAccountIDsarray is empty (no new approver was explicitly tagged), the action is hidden. This combination identifies auto-pay side-effect actions — manual "Take Control" messages (per #69280) havementionedAccountIDspopulated with the new approver and don't haveautomaticAction: true, so they remain visible.The
automaticActionfield is also added to theOriginalMessageTakeControltype definition.Fixed Issues
$ #84288
PROPOSAL: #84288 (comment)
Tests
Offline tests
N/A — This change only affects visibility filtering of server-side report actions. No offline behavior changes.
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand 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
N/A - Logic-only change, no UI modifications
Android: mWeb Chrome
N/A - Logic-only change, no UI modifications
iOS: Native
N/A - Logic-only change, no UI modifications
iOS: mWeb Safari
N/A - Logic-only change, no UI modifications
MacOS: Chrome / Safari
N/A - Logic-only change, no UI modifications