-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature: Stop using reportAction.originalMessage or reportAction.messge #40168
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] |
|
@@ -76,9 +76,9 @@ function extractAttachmentsFromReport(parentReportAction?: OnyxEntry<ReportActio | |||
return; | |||
} | |||
|
|||
const decision = action?.message?.[0]?.moderationDecision?.decision; | |||
const decision = ReportActionsUtils.getReportActionMessage(action)?.moderationDecision?.decision; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
@@ -8,6 +8,7 @@ import DateUtils from './DateUtils'; | |||
import getReportPolicyID from './getReportPolicyID'; | |||
import * as Localize from './Localize'; | |||
import * as PolicyUtils from './PolicyUtils'; | |||
import {getReportActionOriginalMessage} from './ReportActionsUtils'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 ''; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This check seems to be causing this deploy blocker: #44338
The actionName is "REIMBURSEMENTQUEUED"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixing here: #44357
if (!ReportActionsUtils.isReimbursementDeQueuedAction(reportAction)) { | ||
return ''; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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) : ''; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bookmark 🔖
🚀 Deployed to production by https://github.com/yuwenmemon in version: 9.0.1-19 🚀
|
|
||
if (isEmptyObject(report) || !report?.reportID) { | ||
if (isEmptyObject(report) || !report?.reportID || isEmptyObject(iouReportAction)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This caused a regression here #44610
@@ -324,7 +385,10 @@ function getCombinedReportActions(reportActions: ReportAction[], transactionThre | |||
const isSelfDM = report?.chatType === CONST.REPORT.CHAT_TYPE.SELF_DM; | |||
// 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nkdengineer Coming from your new PR #48139, Why did we need to add this check?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DylanDylann It's only used to predict the type of action.
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 Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop