-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Fix/30042 fix lhn previews and report actions v2 #33346
Fix/30042 fix lhn previews and report actions v2 #33346
Conversation
src/libs/SidebarUtils.ts
Outdated
@@ -331,7 +333,11 @@ function getOptionData( | |||
} | |||
: null; | |||
} | |||
const lastActorDisplayName = hasMultipleParticipants && lastActorDetails?.accountID && Number(lastActorDetails.accountID) !== currentUserAccountID ? lastActorDetails.displayName : ''; | |||
|
|||
const lastActorDisplayName = |
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.
Having these inline makes it more and more hard to follow - have you considered abstracting these checks away to a few functions? You can even colocate them nearby if they're not really reusable, but having eg. isCurrentActorLast()
etc will be less cognitively demanding. Not a blocker though, this lgtm :)
if ((result.isChatRoom || result.isPolicyExpenseChat || result.isThread || result.isTaskReport) && !result.isArchivedRoom) { | ||
const isThreadMessage = ReportUtils.isThread(report) && reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.ADDCOMMENT; | ||
|
||
if ((result.isChatRoom || result.isPolicyExpenseChat || result.isThread || result.isTaskReport || isThreadMessage) && !result.isArchivedRoom) { |
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 raises pretty much the same concerns
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 one I'll leave for another refactor
This comment has been minimized.
This comment has been minimized.
@mananjadhav @mountiny One of you needs to 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] |
🧪🧪 Use the links below to test this adhoc build on Android, iOS, Desktop, and Web. Happy testing! 🧪🧪 |
I have done some testing and its working great imho! did not notice any issues long video ahead: Screen.Recording.2023-12-27.at.13.45.20.mp4 |
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.
looking good, one comment
if (originalMessage?.amount !== undefined && lastActorID && !isPreviewMessageForParentChatReport) { | ||
const amount = originalMessage?.amount; | ||
const currency = originalMessage?.currency ?? report.currency ?? ''; | ||
const amountToDisplay = CurrencyUtils.convertToDisplayString(Math.abs(amount), currency); |
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.
In theory the expense report total or request could be negative value, so we should not use Abs here but more so invert the value if expense.
However, I think its not a concern for now
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.
@mountiny so can I leave it for now as it is?
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.
Yes, just noting
const requestorName = lastActorID && lastActorID !== currentUserAccountID ? getDisplayNameForParticipant(lastActorID, !isPreviewMessageForParentChatReport) : ''; | ||
return `${requestorName ? `${requestorName}: ` : ''}${Localize.translateLocal('iou.requestedAmount', {formattedAmount: amountToDisplay})}`; |
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.
const requestorName = lastActorID && lastActorID !== currentUserAccountID ? getDisplayNameForParticipant(lastActorID, !isPreviewMessageForParentChatReport) : ''; | |
return `${requestorName ? `${requestorName}: ` : ''}${Localize.translateLocal('iou.requestedAmount', {formattedAmount: amountToDisplay})}`; | |
// We only want to show the actor name in the preview if its not the current user who took the action | |
const requestorName = lastActorID && lastActorID !== currentUserAccountID ? getDisplayNameForParticipant(lastActorID, !isPreviewMessageForParentChatReport) : ''; | |
return `${requestorName ? `${requestorName}: ` : ''}${Localize.translateLocal('iou.requestedAmount', {formattedAmount: amountToDisplay})}`; |
Starting review now |
@koko57 One change requested, there is an extra space in the IOU/ expense report in front of the You can see it in the video above too |
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.
Took a bit of time but the code changes and Tests look fine. I'll need a day to finish the whole checklist, but approving due to urgency @mountiny
Reviewer Checklist
Screenshots/VideosAndroid: NativeAndroid: mWeb ChromeiOS: NativeiOS: mWeb SafariMacOS: Chrome / SafariMacOS: Desktop |
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.
Thank you!
if (originalMessage?.amount !== undefined && lastActorID && !isPreviewMessageForParentChatReport) { | ||
const amount = originalMessage?.amount; | ||
const currency = originalMessage?.currency ?? report.currency ?? ''; | ||
const amountToDisplay = CurrencyUtils.convertToDisplayString(Math.abs(amount), currency); |
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.
Yes, just noting
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 are platform agnostic and I have tested thoroughly on web and we should be ready to move on, I am merging now before the deploy so we can have Staging QA done on this overnight
Thank you @koko57 for sticking with this one
✋ 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/mountiny in version: 1.4.19-0 🚀
|
🚀 Deployed to production by https://github.com/mountiny in version: 1.4.19-2 🚀
|
Details
Fixed Issues
$ #30042
PROPOSAL: #30042 (comment)
Tests
Create an iouReport
request action preview (requestor view)
request action preview (payer view)
DMs:
owed iouReport being previewed (Agata view - DM)
owed iouReport being previewed (Tom view - DM)
Create an expenseReport
Request action preview (admin viewer)
Request action preview (requestor viewer)
owed expenseReport being previewed (member view - workspace chat)
owed expenseReport being previewed (admin view - workspace chat)
Pay an iouReport
paid action preview (requestor view)
paid action preview (payer view)
paid iouReport being previewed (Agata view - DM)
paid iouReport being previewed (Tom view - DM)
Pay an expenseReport
Paid action preview (admin viewer)
paid action preview (requestor viewer)
paid expenseReport being previewed (member view - workspace chat)
paid expenseReport being previewed (admin view - workspace chat)
Add a comment
comment preview (sender view)
comment preview (receiver view)
comment preview (comment sender viewer)
comment preview (comment receiver viewer)
or when changing the amount
Offline tests
QA Steps
Same as in Test Steps
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label 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
I don't know why but I'm having problem with opening the app on iOS Safari
EXPENSE REPORT
Request action preview (admin viewer)
Request action preview (requestor viewer)
Paid action preview (admin viewer)
paid action preview (requestor viewer)
comment preview (comment sender viewer)
comment preview (comment receiver viewer)
IOU REPORT So that same logic will apply to iouReports as well. For brevity, the below examples are just Agata looking at a variety of actions Tom took only to highlight the
:
in use.request action preview
paid action preview
comment preview
receiver
sender
DM / WORKSPACE CHAT
As for the DM/Workspace Chat LHN preview message when the expense/iouReport is the lastMessage being previewed, those don't use a colon separator because none of the chat participants are the "author" of the report preview component being previewed. So those just use the report title of the expense/iouReport being previewed.
owed iouReport being previewed (Agata view - DM)
owed iouReport being previewed (Tom view - DM)
paid iouReport being previewed (Agata view - DM)
paid iouReport being previewed (Tom view - DM)
owed expenseReport being previewed (member view - workspace chat)
owed expenseReport being previewed (admin view - workspace chat)
paid expenseReport being previewed (member view - workspace chat)
paid expenseReport being previewed (admin view - workspace chat)
MacOS: Desktop