-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Refactor reportAction of context menu #26741
Conversation
ce78838
to
068cc42
Compare
@jjcoffee Have some problems with WebSocket so I will complete all the screenshots tomorrow. |
Updated all screenshots |
reportActionID: PropTypes.string.isRequired, | ||
|
||
/** The ID of the current report of this report action is attached to. */ | ||
originalReportID: PropTypes.string.isRequired, |
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.
Just need a bit of clarity on this one. Can you explain (maybe with an example) what you mean when you say in your proposal "The thread first chat originalReportID and reportID is different."?
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.
The thread first chat is the parent report action. When we pass the reportID
to BaseContextMenu it is the ID of the thread report. Because now we pass the reportActionID to BaseContextMenu, we also need to pass the originalReportID that is the correct reportID of the reportAction to get the detail of the reportAction in Onyx.
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.
Screencast.from.07-09-2023.22.07.10.webm
As you can see in the video, the first message in the thread is the thread first chat.
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.
Thanks, I think I get what you mean now! Maybe a clearer name would be parentReportID
if I understand you correctly?
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.
@jjcoffee Other places in the App also use this name. And if the reportAction isn't the thread first chat reportID
and originalReportID
will be the same. So I think this name is better.
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.
Ah ignore me, I see that we're using the same naming elsewhere!
Reviewer Checklist
Screenshots/VideosWebchrome-desktop-2023-09-08_14.52.10.mp4Mobile Web - Chromeandroid-chrome.mp4Mobile Web - Safariios-safari-2023-09-08_15.28.32.mp4Desktopmac-desktop-2023-09-08_15.31.45.mp4iOSios-native-2023-09-08_15.12.34.mp4Androidandroid-native.mp4 |
@dukenv0307 Could you explain the additional "copy message" steps you added? Just curious, there's nothing wrong with extra steps!
|
src/pages/home/report/ContextMenu/genericReportActionContextMenuPropTypes.js
Outdated
Show resolved
Hide resolved
/** The ID of report action this context menu is attached to. */ | ||
reportActionID: PropTypes.string.isRequired, | ||
|
||
/** The ID of the current report of this report action is attached to. */ |
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.
Could you reword this comment, it's a bit unclear how it's different from the one for reportID
/** The ID of the report this report action is attached to. */
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.
@jjcoffee Updated.
…nuPropTypes.js Co-authored-by: Joel Davies <[email protected]>
@dukenv0307 Sorry, completely forgot that there were two linked issues! Could you update the test steps to refer to |
@jjcoffee Updated the step. |
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.
LGTM!
@@ -32,7 +32,8 @@ function showContextMenuForReport(event, anchor, reportID, action, checkIfContex | |||
'', | |||
anchor, | |||
reportID, | |||
action, | |||
action.reportActionID, | |||
reportID, |
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.
Is it necessary to pass reportID
twice? I see it a couple lines 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.
Oh, I see that maybe it is OK as in another place you are passing originalReportID
here. Could you maybe add code comments to each place to explain why it's different (or the same) as reportID
?
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.
You're right, we also need to get originalReportID here.
src/pages/home/report/ContextMenu/BaseReportActionContextMenu.js
Outdated
Show resolved
Hide resolved
}, | ||
}), | ||
)( | ||
memo(BaseReportActionContextMenu, (prevProps, nextProps) => { |
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.
Can you please add code comments to explain why this memo is here and what it's purpose is?
@tgolen Just updated all suggestions. |
@dukenv0307 Can you merge main and retest (see here on Slack)? |
@jjcoffee Merged main and tested. |
Removing HOLD and merging this |
✋ 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/tgolen in version: 1.3.68-0 🚀
|
withWindowDimensions, | ||
withOnyx({ | ||
reportActions: { | ||
key: ({originalReportID}) => `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${originalReportID}`, |
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.
with thread report, this will lead to empty reportAction
because it always get the reportActions
of the parent.
Slack report: https://expensify.slack.com/archives/C049HHMV9SM/p1694515263690629
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.
@hungvu193 Because the structure of the complete task is wrong. This is stored in the task report but the field means this is the parent report action #24644
🚀 Deployed to production by https://github.com/Julesssss in version: 1.3.68-17 🚀
|
isArchivedRoom={ReportUtils.isArchivedRoom(originalReport)} | ||
reportActionID={props.action.reportActionID} | ||
originalReportID={originalReportID} | ||
isArchivedRoom={ReportUtils.isArchivedRoom(props.report)} |
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 are using report
to check isArchivedRoom
here in the MiniReportActionContextMenu
but originalReport/originalReportID
to check isArchivedRoom
in ReportActionContextMenu.showContextMenu
. Was this a mistake or was there some logic in this?
Details
Instead of passing
reportAction
into ContextMenu, we will passreportActionID
and getreportAction
through withOnyxFixed Issues
$ #25538
PROPOSAL: #25538 (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 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
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)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)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
Web
Screencast.from.06-09-2023.23.46.25.webm
Mobile Web - Chrome
Screencast.from.06-09-2023.23.46.25.webm
Mobile Web - Safari
Screen-Recording-2023-09-07-at-09.43.41.mp4
Desktop
Screen.Recording.2023-09-07.at.09.48.22.mov
iOS
Screen-Recording-2023-09-07-at-09.41.32.mp4
Android
25538.mp4