Repository navigation
Add UPDATE_FEATURE_ENABLED handler to OptionsListUtils for LHN preview text - #84616
Conversation
Normalize backend 'value' field to 'rate' for tax update messages and add fallback to server-provided text when translation returns empty. Co-authored-by: Mykhailo <mkhutornyi@users.noreply.github.com>
|
I created this PR from an upstream branch since I don't have push access to your fork. To take ownership of this branch and be able to push updates, run: Then you can close this PR and open a new one from your fork. |
| if (action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_TAX && taxName) { | ||
| return translate('workspaceActions.updateTax', { | ||
| // The backend sends 'value' for tax rate changes, but the translation expects 'rate' | ||
| const normalizedUpdatedField = updatedField === 'value' ? 'rate' : updatedField; |
There was a problem hiding this comment.
@MelvinBot backend is sending rate correctly, not value so this change is not needed
There was a problem hiding this comment.
Thanks for the correction. I've removed the value-to-rate normalization since the backend already sends rate as the updatedField.
I kept the fallback on line 2930 (return message || getReportActionText(action)) as a defensive measure -- if the translation ever returns an empty string for an unrecognized updatedField, it will fall back to the server-provided action text rather than showing nothing. This addresses the original issue where messages were missing.
However, since you confirm the backend sends the correct field values, the root cause of the missing messages reported in the issue may lie elsewhere. Could you help clarify what scenario leads to the missing thread messages?
There was a problem hiding this comment.
Thanks for the correction. Removed the value-to-rate normalization since the backend already sends rate as the updatedField.
I kept the return message || getReportActionText(action) fallback as a defensive measure — the updateTax translation has a default case that returns an empty string, so if the backend ever sends an updatedField value not in the switch (name, code, rate, enabled), this fallback prevents an invisible message by falling back to the server-provided action text. If you'd prefer this removed as well, let me know.
|
Lines 1005 to 1006 in 873d7bb @MelvinBot Precondition: Switch to another language (i.e. Spanish).
|
The backend already sends 'rate' as the updatedField, so the normalization from 'value' to 'rate' is not needed. Keep the fallback to getReportActionText when translation returns empty. Co-authored-by: Mykhailo <mkhutornyi@users.noreply.github.com>
…search results Co-authored-by: Mykhailo <mkhutornyi@users.noreply.github.com>
|
Added |
| newValue: normalizeTaxValue(newValue), | ||
| }); | ||
|
|
||
| return message || getReportActionText(action); |
There was a problem hiding this comment.
@MelvinBot No need this change as well. message always exists so || getReportActionText(action) is never reached. Please roll back to main code
There was a problem hiding this comment.
Reverted src/libs/ReportActionsUtils.ts back to the main version. The PR diff for this file is now empty — no changes remain.
| if (isActionOfType(lastReportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_FOREIGN_CURRENCY_DEFAULT_TAX)) { | ||
| lastMessageTextFromReport = getForeignCurrencyDefaultTaxUpdateMessage(translate, lastReportAction); | ||
| } | ||
| if (lastReportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_FEATURE_ENABLED) { |
There was a problem hiding this comment.
Good catch — updated to use isActionOfType to be consistent with the surrounding checks.
Co-authored-by: Mykhailo <mkhutornyi@users.noreply.github.com>
Co-authored-by: Mykhailo <mkhutornyi@users.noreply.github.com>
| if (isActionOfType(lastReportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_FEATURE_ENABLED)) { | ||
| lastMessageTextFromReport = getWorkspaceFeatureEnabledMessage(translate, lastReportAction); | ||
| } |
There was a problem hiding this comment.
@MelvinBot update PR title, Explanation of Change and Tests, QA steps to reflect this change.
|
@MelvinBot mark as ready for review |
|
Updated the PR title, Explanation of Change, and Test steps to reflect the current change — adding an |
|
@mkhutornyi 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 ✅ |
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.
|
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb Safari |
|
We did not find an internal engineer to review this PR, trying to assign a random engineer to #81791 as well as to this PR... Please reach out for help on Slack if no one gets assigned! |
|
@MelvinBot In Tests/QA Step 4: |
|
Updated both Tests Step 4 and QA Steps Step 4 to use "enabled tax tracking" or "disabled tax tracking". |
trjExpensify
left a comment
There was a problem hiding this comment.
Makes sense that tax is included in this. 👍
|
🚧 @Beamanator 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/Beamanator in version: 9.3.35-0 🚀
|
|
🚀 Deployed to production by https://github.com/luacmartins in version: 9.3.35-1 🚀
|



Explanation of Change
The
getLastMessageTextForReportfunction inOptionsListUtilshandles variousPOLICY_CHANGE_LOGaction types to generate localized preview text for the LHN (Left Hand Navigation). However,UPDATE_FEATURE_ENABLEDactions (triggered when a workspace feature like Taxes is enabled/disabled in More Features) were missing a handler. This meant the LHN would fall back to non-localized server text for these actions.This PR adds the missing
UPDATE_FEATURE_ENABLEDhandler, calling the existinggetWorkspaceFeatureEnabledMessagefunction (already used elsewhere inReportActionsUtils) to produce proper localized preview text in the LHN.Fixed Issues
$ #81791
PROPOSAL: #81791 (comment)
Tests
Offline tests
N/A — These are server-pushed policy changelog actions that only appear when online.
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 — No UI changes, only LHN preview text logic
Android: mWeb Chrome
N/A — No UI changes, only LHN preview text logic
iOS: Native
N/A — No UI changes, only LHN preview text logic
iOS: mWeb Safari
N/A — No UI changes, only LHN preview text logic
MacOS: Chrome / Safari
N/A — No UI changes, only LHN preview text logic