Fix: use server-rendered message for moved-report action when destination policy is unavailable locally - #98238
Fix: use server-rendered message for moved-report action when destination policy is unavailable locally#98238MelvinBot wants to merge 2 commits into
Conversation
…tion policy is unavailable locally Co-authored-by: Nyoman Jyotisa <nyomanjyotisa@users.noreply.github.com>
…s live Co-authored-by: Nyoman Jyotisa <nyomanjyotisa@users.noreply.github.com>
|
Fixed the failing check. Pushed What was failing: Root cause (directly from this PR's change): the test's MOVED action uses Fix: seed Other non-passing checks (not addressed — not code failures)
|
|
The real failure is already fixed by my earlier push (
The only checks still showing as failed are |
|
The code-related failures are resolved by my earlier push ( The only checks still red are |
Updated PR descriptionTests
Offline tests
QA StepsSame as Tests and Offline tests.
PR Author Checklist
Screenshots/VideosAndroid: NativeAndroid-pr98238.mp4Android: mWeb ChromeAndroid-mWeb-pr98238.mp4iOS: Nativeios-pr98238.mp4iOS: mWeb Safariios-mWeb-pr98238.mp4MacOS: Chrome / SafariChrome-pr98238.mp4@MelvinBot please replace the PR description from |
|
✅ Done — I replaced the PR description from |
Explanation of Change
The workspace name in the "moved this report to the … workspace" system message was recomputed on every render from the current user's local Onyx policy collection, with a bare empty-string fallback:
When User A is not a member of the destination workspace and never opened it,
policy_<toPolicyID>isn't in their Onyx, so the lookup returns''and the message renders with a blank name. It only appeared later because creating another expense delivered that policy into User A'sCOLLECTION.POLICY, after which the message re-rendered correctly.This change makes
getMovedActionMessagefall back to the server-rendered action message (getReportActionHtml(action)) when the destination policy isn't available locally (sotoPolicyNamewould be empty). The broadcast action already carries the name the server rendered, so User A sees it immediately. When the policy is present locally, the current live-computed string is kept so nothing else changes. This mirrors the existing pattern where messages fall back to the stored action text when their computed inputs aren't available. Returning the stored HTML covers both consumption paths — the HTML-rendered report view and the plain-text LHN/preview callers that wrap the result inParser.htmlToText(...).A unit test was added covering the fallback path (destination policy absent locally → stored action HTML returned).
Fixed Issues
$ #98108
PROPOSAL: #98108 (comment)
Tests
Offline tests
QA Steps
Same as Tests and Offline tests.
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-pr98238.mp4
Android: mWeb Chrome
Android-mWeb-pr98238.mp4
iOS: Native
ios-pr98238.mp4
iOS: mWeb Safari
ios-mWeb-pr98238.mp4
MacOS: Chrome / Safari
Chrome-pr98238.mp4