Fix - Update getIOUReportActionDisplayMessage() to accept the transaction as a parameter#38882
Conversation
|
@hoangzinh 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] |
|
@hoangzinh @tgolen I am having difficulty coming up with a report action that is displayed with App/src/pages/home/report/ReportActionItemMessage.tsx Lines 69 to 70 in 85d761b All the report actions we calculate the message via the linked transactions are all displayed with MoneyRequestActionApp/src/pages/home/report/ReportActionItem.tsx Lines 410 to 422 in 85d761b I feel like may be it an obsolete code but it would be nice if you can give me one instance I can test with. TIA |
|
Can you try with paid message?
|
Thx for the help! But sorry if I haven't made it clear, indeed there are instances where Lines 5136 to 5137 in 85d761b It doesn't utilize transaction param which is relevant to this PR hereLines 5139 to 5140 in 85d761b |
|
I see, I couldn't find a case to test it either. Let's wait for @tgolen |
|
Yes, I believe I ran into this when I was first looking at the code as well, so thank you for confirming it. I couldn't find anyway of triggering the logic either, but I was fearful there was just something I didn't know or was perhaps overlooking. I think what the safest thing to do would be:
It's also possible that when the first step is done, QA will be able to find a regression with it. In that case, it would be a faster way of getting to the final end goal of having this code cleaned up. What do you think of that plan? |
BTW it is not Regarding BE logging you are suggesting why don't we just pass the param from |
…to-take-transaction-param
Hold-on @FitseTLT I think it's still useful in case copy-to-clipboard, isn't it? App/src/pages/home/report/ContextMenu/ContextMenuActions.tsx Lines 366 to 368 in a51e60e |
|
Yep @hoangzinh I mentioned it here
|
@FitseTLT Thanks for confirming. Reg. your point, I prefer to split it out instead of making it optional. For example, split those logic intos a function Lines 5132 to 5150 in 9dd66cf Then use it in the |
…to-take-transaction-param
|
Nice @hoangzinh But if we are going to utilize BE log then we should separate it after we confirm that transaction is not needed from when we call it from ReportActionItemMessage via the BE Log 👍 |
|
OK, I understatnd what you mean about the |
|
@hoangzinh U can proceed on the review, I have added the server logging code 👍 |
| const originalMessage = action?.actionName === CONST.REPORT.ACTIONS.TYPE.IOU ? action.originalMessage : null; | ||
| return `${ONYXKEYS.COLLECTION.TRANSACTION}${originalMessage?.IOUTransactionID ?? 0}`; |
There was a problem hiding this comment.
Should it be
| const originalMessage = action?.actionName === CONST.REPORT.ACTIONS.TYPE.IOU ? action.originalMessage : null; | |
| return `${ONYXKEYS.COLLECTION.TRANSACTION}${originalMessage?.IOUTransactionID ?? 0}`; | |
| return `${ONYXKEYS.COLLECTION.TRANSACTION}${action?.originalMessage?.IOUTransactionID ?? ''}`; |
There was a problem hiding this comment.
Yeah I know but it is to avoid TS error; it used in all other places too. I guess it is better than suppressing the ts error
There was a problem hiding this comment.
Oh right, then is it possible to reuse ReportActionUtils.getLinkedTransactionID here?
There was a problem hiding this comment.
Couldn't that lead us to conflict with the purpose of this pr as the function uses allReportActions to get the action
App/src/libs/ReportActionsUtils.ts
Line 655 in d93cb32
There was a problem hiding this comment.
Hmm, wish it accepted a reportAction input. The idea here is centralize how we get a transactionID from a reportAction
There was a problem hiding this comment.
Hi @FitseTLT I'm thinking should we create another util, getLinkedTransactionIDFromReportAction. In PR checklist, we have a checkbox about DRY code.
…to-take-transaction-param
src/pages/home/report/ContextMenu/BaseReportActionContextMenu.tsx
Outdated
Show resolved
Hide resolved
src/pages/home/report/ContextMenu/BaseReportActionContextMenu.tsx
Outdated
Show resolved
Hide resolved
Reviewer Checklist
Screenshots/VideosAndroid: NativeScreen.Recording.2024-03-31.at.09.58.44.android.movAndroid: mWeb ChromeScreen.Recording.2024-03-31.at.10.05.29.android.chrome.moviOS: NativeScreen.Recording.2024-03-31.at.09.55.23.ios.moviOS: mWeb SafariScreen.Recording.2024-03-31.at.09.52.09.ios.safari.movMacOS: Chrome / SafariScreen.Recording.2024-03-31.at.09.47.06.web.movMacOS: DesktopScreen.Recording.2024-03-31.at.09.49.24.desktop.mov |
Oops, sorry... that should have been a "requested changes" review
|
Also logged |
|
✋ 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 production by https://github.com/Julesssss in version: 1.4.60-13 🚀
|
Details
Fixed Issues
$ #38355
PROPOSAL: #38355 (comment)
Tests
Note: This is a refactoring pr so what we need to check is that things mentioned below work fine same as current main
Offline tests
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and using the translation methodWaiting for Copylabel for a copy review on the original GH to get the correct copy.STYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel so 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
nat.mp4
Android: mWeb Chrome
and.web.mp4
iOS: Native
ios.mp4
iOS: mWeb Safari
w.mp4
MacOS: Chrome / Safari
web.mp4
MacOS: Desktop
d.mp4