feature: Stop using reportAction.originalMessage or reportAction.messge#40168
feature: Stop using reportAction.originalMessage or reportAction.messge#40168roryabraham merged 62 commits intoExpensify:mainfrom
Conversation
|
@cubuspl42 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] |
|
There was a problem hiding this comment.
Please introduce a local variable, so we don't repeat ourselves and so the lines don't get extremely long.
Please do that in other spots of the PR, wherever it's easy to do.
src/libs/ModifiedExpenseMessage.ts
Outdated
There was a problem hiding this comment.
We always import ReportActionsUtils like import * as ReportActionsUtils; this would be a precedence. I know it affects line length, but I think we should keep being consistent
|
@cubuspl42 I'm updating, will ping you back when completed. |
|
Please fill the Details, at least one sentence. You could mention that this PR is part of Phase 1, linking this plan. |
|
Please correct me if I'm wrong, but it looks like we're quite far from being done here. Please search the code for the string |
|
@cubuspl42 I refactor by checking |
(I assume you meant "fields") But if this is the case, how can we execute the Phase 2...
...? cc: @quinthar |
|
Conflicts ⚔️ |
|
The clarification question you is: was your original intention to remove
Would you expand on this, providing examples? As typing was added to Expensify relatively recently, it would be best if you focused on analyzing the backend-returned data in addition to inspecting the TypeScript types. |
|
@cubuspl42 Here is an example. For iou action, the
|
|
@nkdengineer Unit tests fail |
|
We're discussing this PR on Slack |
|
@nkdengineer @parasharrajat will be taking over to review the PR. |
|
@parasharrajat About this concern here #40168 (comment), can you please tell me the update of the discuss in Slack here #40168 (comment)? Thanks. |
|
@nkdengineer There are a few |
|
I'm fixing. |
|
@c3024 Can you please share with me what is the result of this discussion #40168 (comment)? |
|
We will replace all cases where fields are available in both |
|
✋ 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/roryabraham in version: 9.0.1-0 🚀
|
Based on this description we assumed all report actions that have |
| if (!ReportActionsUtils.isMoneyRequestAction(reportAction)) { | ||
| return ''; | ||
| } |
| if (!ReportActionsUtils.isReimbursementDeQueuedAction(reportAction)) { | ||
| return ''; | ||
| } |
There was a problem hiding this comment.
Wondering if this check could cause a similar problem like the one here: https://github.com/Expensify/App/pull/40168/files#r1651736267
|
I'm pretty sure this PR is the cause if this blocker: #40168 |
|
Found a regression from this PR, fix is up here |
|
@blazejkustra that is included in this followup PR #44365. |
| function getReportActionText(reportAction: PartialReportAction): string { | ||
| const html = getReportActionHtml(reportAction); | ||
| const parser = new ExpensiMark(); | ||
| return html ? parser.htmlToText(html) : ''; | ||
| } | ||
|
|
||
| function getTextFromHtml(html?: string): string { | ||
| const parser = new ExpensiMark(); | ||
| return html ? parser.htmlToText(html) : ''; | ||
| } |
|
🚀 Deployed to production by https://github.com/yuwenmemon in version: 9.0.1-19 🚀
|
| const reportActionMessage = ReportActionsUtils.getReportActionHtml(iouReportAction); | ||
|
|
||
| if (isEmptyObject(report) || !report?.reportID) { | ||
| if (isEmptyObject(report) || !report?.reportID || isEmptyObject(iouReportAction)) { |
There was a problem hiding this comment.
These changes caused this issue
Empty iouReportAction leads to an empty preview message, causing the chat will not be displayed in LHN.
| } else if ( | ||
| lastActionName === CONST.REPORT.ACTIONS.TYPE.ROOM_CHANGE_LOG.INVITE_TO_ROOM || | ||
| lastActionName === CONST.REPORT.ACTIONS.TYPE.ROOM_CHANGE_LOG.REMOVE_FROM_ROOM || | ||
| lastActionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.INVITE_TO_ROOM || | ||
| lastActionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.REMOVE_FROM_ROOM | ||
| ) { | ||
| const lastActionOriginalMessage = lastAction?.actionName ? (lastAction?.originalMessage as ChangeLog) : null; | ||
| } else if (ReportActionsUtils.isRoomChangeLogAction(lastAction)) { |
| // Filter out request and send money request actions because we don't want to show any preview actions for one transaction reports | ||
| const filteredReportActions = [...reportActions, ...filteredTransactionThreadReportActions].filter((action) => { | ||
| const actionType = (action as OriginalMessageIOU).originalMessage?.type ?? ''; | ||
| if (!isMoneyRequestAction(action)) { |
There was a problem hiding this comment.
@nkdengineer Coming from your new PR #48139, Why did we need to add this check?
There was a problem hiding this comment.
@DylanDylann It's only used to predict the type of action.
| ...expenseReport, | ||
| lastMessageText: optimisticReportAction.message?.[0]?.text, | ||
| lastMessageHtml: optimisticReportAction.message?.[0]?.html, | ||
| lastMessageText: ReportActionsUtils.getReportActionText(optimisticReportAction), |
There was a problem hiding this comment.
We need to update lastVisibleActionCreated to optimisticReportAction?.created. Ref: #53077
| return parentReportActionMessage || Localize.translateLocal('parentReportAction.deletedMessage'); | ||
| } | ||
| const originalMessage = isChangeLogObject(parentReportAction.originalMessage); | ||
| if (!ReportActionsUtils.isPolicyChangeLogAction(parentReportAction) || !ReportActionsUtils.isRoomChangeLogAction(parentReportAction)) { |
There was a problem hiding this comment.
This condition is always true, we should use && instead of ||. For more information: #54621

Details
This PR is part of Phase 1, linking this plan
Fixed Issues
$ #39797
PROPOSAL: #39797 (comment)
Tests
Offline tests
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))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
MacOS: Desktop