[CP Stg] Fix category change log thread header to match the system message - #98495
Conversation
The thread header for a POLICY_CHANGE_LOG.UPDATE_CATEGORY action falls back to the raw server text instead of the copy shown in the chat system message.
…resolver Thread headers for category add/delete/update/rename actions fell back to the raw server text, so they disagreed with the system message in the chat.
Moves the HeaderView case below the shared render helper, uses the empty oldValue the server sends the first time attendees are required, and adds unit coverage for the four action types and the policy-formatted amounts.
Description hints are stored as HTML, so interpolating them directly leaked escaped entities into the system message and, now that the thread header shares the same resolver, into the report name too.
Pins which side of the message the workspace default amount lands on.
|
@nyomanjyotisa 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] |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppScreen.Recording.2026-08-12.at.11.41.47.PM.moviOS: mWeb SafariMacOS: Chrome / SafariScreen.Recording.2026-08-12.at.11.38.23.PM.mov |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bcf213dbef
ℹ️ 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".
| isActionOfType(parentReportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_CATEGORY) || | ||
| isActionOfType(parentReportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.SET_CATEGORY_NAME) | ||
| ) { | ||
| return getWorkspaceCategoryUpdateMessage(translate, parentReportAction, reportPolicy); |
There was a problem hiding this comment.
Recompute category headers when policy defaults change
When this new branch handles an UPDATE_CATEGORY action for maxAmountNoReceipt or maxAmountNoItemizedReceipt, getWorkspaceCategoryUpdateMessage() formats the header from reportPolicy.maxExpenseAmountNoReceipt / maxExpenseAmountNoItemizedReceipt and outputCurrency (see ReportActionsUtils around the receipt-threshold cases). However the derived report-name cache only invalidates policy changes listed in hasPolicyRelevantFieldChanged() in src/libs/actions/OnyxDerived/configs/reportAttributes.ts, and those fields are not included there. If the workspace receipt default or currency changes after this thread title has been cached, the header can keep showing the old/default amount while the chat message recomputes from the latest policy, so please add these policy fields to the report-name invalidation or avoid depending on mutable policy data here.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
not a regression, but probably a legitimate bug we can address in a follow-up.
There was a problem hiding this comment.
We can probably DRY this since it's kinda repeated in src/libs/OptionsListUtils/index.ts
|
on it! |
| return translate('workspaceActions.updatedDescriptionHint', decodedOptionName, newValue as string | undefined, oldValue as string | undefined); | ||
| // Description hints are stored as HTML, so they have to be converted back to plain text to read correctly in a message | ||
| const newHint = typeof newValue === 'string' && newValue ? Parser.htmlToText(newValue) : undefined; | ||
| const oldHint = typeof oldValue === 'string' && oldValue ? Parser.htmlToText(oldValue) : undefined; | ||
| return translate('workspaceActions.updatedDescriptionHint', decodedOptionName, newHint, oldHint); |
There was a problem hiding this comment.
Category description hints are persisted as HTML, so a hint of
Client's & partner's namesis stored asClient's & partner's names.
This seems separate bug.
Do you have repro step? I am not able to reproduce raw html rendering
There was a problem hiding this comment.
Nvm, I reproduced with markdown input
i.e. <strong>Client</strong> names instead of Client names
The global search list takes its row label from the derived report name, so it showed the raw server text for the same reason the thread header did.
The search result subtitle is the last message preview, which is resolved separately from the report name and still shows the raw server text.
The search results list resolves its subtitle here rather than through the report name, so it still rendered the raw server text.
The same four-way action type check had grown to three call sites.
|
One more place to dry: App/src/pages/inbox/report/ContextMenu/ContextMenuActions.tsx Lines 1060 to 1065 in 6744c59 |
Adds coverage for the category branch, which had none.
|
🚧 roryabraham 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. |
…ad-header [CP Stg] Fix category change log thread header to match the system message (cherry picked from commit 96fad2f) (cherry-picked to staging by roryabraham)
|
🔁 Filed a Staging retest request for deploy blockers #98482 after this PR was cherry-picked to staging. |
|
🚀 Cherry-picked to staging by https://github.com/roryabraham in version: 9.4.53-1 🚀
|
|
🤖 I reviewed this PR against the help site files under Why: This is an internal message-rendering consistency fix, not a feature or behavior change:
The underlying features these messages describe — expense categories, Require fields / Require attendees, and description hints — are already documented, and none of those articles (Create-expense-categories.md, Workspace-Rules.md) reference the exact wording of workspace change-log system messages. Since this PR only makes that internal copy render consistently and doesn't change how any feature is configured or used, there's nothing on the help site to update. @roryabraham, no help site PR was created since no documentation changes are required. If you feel a doc update is warranted here, reply with |
|
🚀 Deployed to production by https://github.com/roryabraham in version: 9.4.53-10 🚀
Bundle Size Analysis (Sentry): |
|
🚀 Cherry-picked to staging by https://github.com/roryabraham in version: 9.4.54-0 🚀
|
|
🤖 Help site review: no changes required. I reviewed the changes in this PR against Expensify's help site articles under Why no docs changes are neededThis PR is a purely internal message-rendering consistency fix. It routes workspace category change-log action types ( None of this changes how a user configures categories, category rules, attendee tracking, or description hints — it only fixes the wording/consistency of the automatically-generated audit-trail messages shown in chat, thread headers, the LHN preview, and copy-to-clipboard. The help site articles (e.g. @roryabraham, this is just a heads-up — no linked help site PR was created since no documentation changes are required. Let me know if you'd still like a docs update for anything here. |




Explanation of Change
There are two parallel report-action → text resolvers in the App:
getWorkspaceCategoryUpdateMessageinsrc/libs/ReportActionsUtils.tscomputeReportNameBasedOnReportActioninsrc/libs/ReportNameUtils.ts#97919 added the new
updateAreAttendeesRequiredcopy to the first resolver, but the second has never had a branch for the category change log action types, so it fell through to the raw server-generated text. That's why the chat showschanged the "Advertising" category attendees to required (previously not required)while the thread header showsupdated the category "Advertising" by changing the Attendees from Not Required to Required.This routes more action types through
getWorkspaceCategoryUpdateMessageincomputeReportNameBasedOnReportAction, mirroring whatSidebarUtils.getOptionData'scategoryResolveralready does with the same action types. Since that resolver falls back togetReportActionTextfor anything it doesn't recognize, an unhandledupdatedFieldkeeps rendering exactly what it renders today.Second, smaller change. Category description hints are persisted as HTML, so a hint of
Client's & partner's namesis stored asClient's & partner's names.getWorkspaceCategoryUpdateMessageuse that raw value. The chat happened to hide the entities becauseReportActionItemBasicMessageappliesStr.htmlDecodewhen rendering, but it still leaked tags there, and the entities leaked verbatim into the LHN preview and the copy-to-clipboard text. ThecommentHintbranch now runs the values throughParser.htmlToText, which handles both entities and the<br />a multi-line hint produces.Two related gaps found while working on this that are deliberately not in this PR:
SidebarUtilscallsgetWorkspaceCategoryUpdateMessagewithout thepolicyargument, so LHN previews for the two receipt-threshold fields can still disagree with the chat and header.POLICY_CHANGE_LOG.UPDATE_CATEGORIES(plural) is still not routed inReportNameUtils, so a thread on "updated N categories" keeps showing raw server text.Fixed Issues
$ #98482
PROPOSAL:
Tests
#adminsand open the workspace change log thread.changed the "Advertising" category attendees to required (previously not required).changed the "Advertising" category attendees to required (previously not required)— the same copy as the system message, notupdated the category "Advertising" by changing the Attendees from Not Required to Required.Client's & partner's names, and save.added the description hint "Client's & partner's names" to the category "Advertising"with no'or&escapes, and that the LHN preview for that thread reads the same.Offline tests
n/a - category change logs come from the server
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
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari