Repository navigation
Conversation
Co-authored-by: Georgia Monahan <grgia@users.noreply.github.com>
|
🤖 Android test steps verification results: ❌ fail The PR's Tests section is still a TODO, so I ran the reproduction steps from the linked issue. As on Web, the system message shows both signs reversed: "changed the tax amount to -$2.00 (previously $4.76)" instead of "changed the tax amount to $2.00 (previously -$4.76)". The text stayed the same after reopening the report, so the wrong sign comes from the saved data, not just the optimistic update.
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@bernhardoj 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] |
| const oldTaxAmountValue = getTaxAmountAbsValue(reportActionOriginalMessage?.oldTaxAmount ?? 0); | ||
| const oldTaxAmount = convertToDisplayString(oldTaxAmountValue, currency); | ||
| const taxAmount = convertToDisplayString(reportActionOriginalMessage?.taxAmount ?? 0, currency); | ||
| const oldTaxAmount = convertToDisplayString(reportActionOriginalMessage?.oldTaxAmount ?? 0, currency); |
There was a problem hiding this comment.
@MelvinBot We need to use getTaxAmount here. Since tax is only available on an expense report, then we can always pass true for isFromExpenseReport.
There was a problem hiding this comment.
Done in b723726. The message now converts both tax amounts with getTaxAmount(..., true) (ModifiedExpenseMessage.ts:469-470). This matches the Web test above, where the server's values rendered as "to -$2.00 (previously $4.76)".
Two related changes:
- Optimistic action: it now stores both values with the stored sign, like the server, so the message doesn't flip after the response (ReportUtils.ts:7030-7032).
getTaxAmounttype: it now acceptsPick<Transaction, 'taxAmount'>, so we can pass the report action's values without a full transaction (TransactionUtils/index.ts:552). Existing callers are unchanged.
I updated the unit test to use stored-sign values and added a test for the optimistic action. Typecheck, lint, and the related Jest suites pass. I didn't re-run the Web test, and the PR description's Explanation section still describes the old approach.
There was a problem hiding this comment.
@MelvinBot oh, can we use the normalizeTaxAmount instead?
There was a problem hiding this comment.
Done in 25c63d8. The message now calls normalizeTaxAmountSign(..., true) on both tax amounts directly (ModifiedExpenseMessage.ts:469-470).
To do this, I exported normalizeTaxAmountSign from TransactionUtils (index.ts:1843). I also reverted the Pick<Transaction, 'taxAmount'> change to getTaxAmount, since it's no longer needed. The output is the same, and the optimistic action change is unchanged.
Typecheck and the ModifiedExpenseMessage and TransactionUtils Jest suites pass. ESLint shows no new errors on the changed lines.
…essage The server sends taxAmount/oldTaxAmount with the stored (inverted) sign, so convert them with getTaxAmount. Store the optimistic values the same way so the message doesn't flip after the server responds. Co-authored-by: Bernhard Owen Josephus <bernhardoj@users.noreply.github.com>
|
@bernhardoj 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] |
…e system message Co-authored-by: Bernhard Owen Josephus <bernhardoj@users.noreply.github.com>
trjExpensify
left a comment
There was a problem hiding this comment.
Reviewer note: I couldn't check the backend's MODIFIED_EXPENSE originalMessage from App code. Please confirm the server sends oldTaxAmount/taxAmount with the display sign, as it does for oldAmount/amount. If it sends the stored (inverted) sign, the message will flip after the server response.
Did @grgia look into that for you to confirm?
|












Explanation of Change
The "changed the tax amount to X (previously Y)" system message ran both tax amounts through
Math.abs(). So on a negative expense, the previous tax amount showed as positive.That
Math.abs()was written when tax amounts were always shown as positive. Since #102175, the expense details page shows the signed tax amount, so the message and the page disagreed.This PR removes
getTaxAmountAbsValueand formatstaxAmountandoldTaxAmountwith their sign, the same way the amount message already does. The optimistic action already stores both values with the display sign (ReportUtils.tssetsoldTaxAmountfromgetTaxAmount(oldTransaction, isFromExpenseReport)).Reviewer note: I couldn't check the backend's
MODIFIED_EXPENSEoriginalMessagefrom App code. Please confirm the server sendsoldTaxAmount/taxAmountwith the display sign, as it does foroldAmount/amount. If it sends the stored (inverted) sign, the message will flip after the server response.Fixed Issues
$ #103702
PROPOSAL: #103702 (comment)
Tests
// TODO: The human co-author must fill out the tests you ran before marking this PR as "ready for review"
// Please describe what tests you performed that validates your changed worked.
Offline tests
QA Steps
// TODO: The human co-author must fill out the QA tests you ran before marking this PR as "ready for review".
// Please describe what QA needs to do to validate your changes and what areas do they need to test for regressions.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)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: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari