-
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
Fix deleting parent thread message temporary disappearing #26548
Conversation
@fedirjh Thank you for your patience. Unfortunately, we're currently experiencing an issue https://expensify.slack.com/archives/C01GTK53T8Q/p1693595827771879 that has resulted in the native iOS and Android test videos being missing. I'll make sure to attach those videos as soon as the issue is resolved |
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.
Left some concern about the optimistic data.
src/libs/ReportUtils.js
Outdated
@@ -1797,6 +1797,7 @@ function buildOptimisticAddCommentReportAction(text, file) { | |||
attachmentInfo, | |||
pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD, | |||
shouldShow: true, | |||
childType: '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.
childType: 'chat', | |
childType: CONST.REPORT.TYPE.CHAT, |
@Nodebrute I am not sure if this is the correct place to apply the optimistic data. This change will affect all created comments, even those that don't have a child report.
I think it makes sense to apply the optimistic data when we navigate to the child report inside navigateToAndOpenChildReport.
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.
Hey @fedirjh, you're absolutely right. Thank you for catching this bug. Please excuse my inexperience, but could you please guide me on how to set data optimistically here?
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.
@fedirjh gentle bump
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.
Hey @Nodebrute Thanks for the ping. After looking at the code, the changes should be applied to this line and we should add the failureData
as well.
App/src/libs/actions/Report.js
Lines 526 to 532 in e552700
// If we are creating a thread, ensure the report action has childReportID property added | |
if (newReportObject.parentReportID && parentReportActionID) { | |
onyxData.optimisticData.push({ | |
onyxMethod: Onyx.METHOD.MERGE, | |
key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${newReportObject.parentReportID}`, | |
value: {[parentReportActionID]: {childReportID: 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.
Thank you for your patience and for assisting me, @fedirjh. I've implemented the suggested changes, and I've attached all the test videos. Your review would be greatly appreciated.
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 inform me if there is anything else I may have overlooked.
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.
cc @Nodebrute Looks good and tests well, just left some minor code improvements.
Reviewer Checklist
Screenshots/VideosWebCleanShot.2023-09-05.at.08.25.27.mp4CleanShot.2023-09-05.at.08.27.11.mp4Mobile Web - ChromeCleanShot.2023-09-05.at.08.52.27.mp4Mobile Web - SafariCleanShot.2023-09-05.at.08.40.38.mp4DesktopCleanShot.2023-09-05.at.08.33.32.mp4iOSCleanShot.2023-09-05.at.08.45.49.mp4AndroidCleanShot.2023-09-05.at.09.06.34.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.
Tests well, Left some comments about the code.
src/libs/ReportActionsUtils.js
Outdated
* @param {Object} reportAction | ||
* @param {Number} 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.
* @param {Number} reportID | |
* @param {String} reportID |
reportID
has type string.
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.
Let's address this comment as well.
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.
I'm not sure how I overlooked this, but I've just corrected it.
@@ -53,7 +53,7 @@ function ReportActionItemMessage(props) { | |||
fragment={fragment} | |||
isAttachment={props.action.isAttachment} | |||
iouMessage={iouMessage} | |||
hasCommentThread={ReportActionsUtils.hasCommentThread(props.action)} | |||
isThreadParentMessage={ReportActionsUtils.isThreadParentMessage(props.action, props.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.
Let's add this prop reportID
to the propTypes
definition.
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.
cc @Nodebrute , props.reportID
is not defined in the propTypes
, it should be added to this block
const propTypes = { |
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.
I've just fixed this one as well. I apologize for the numerous mistakes.
src/libs/ReportActionsUtils.js
Outdated
function isThreadParentMessage(reportAction, reportID) { | ||
return ( | ||
lodashGet(reportAction, 'childType', '') === CONST.REPORT.TYPE.CHAT && | ||
(lodashGet(reportAction, 'childVisibleActionCount', 0) > 0 || (!_.isUndefined(reportAction.childReportID) && reportAction.childReportID.toString() === 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.
function isThreadParentMessage(reportAction, reportID) { | |
return ( | |
lodashGet(reportAction, 'childType', '') === CONST.REPORT.TYPE.CHAT && | |
(lodashGet(reportAction, 'childVisibleActionCount', 0) > 0 || (!_.isUndefined(reportAction.childReportID) && reportAction.childReportID.toString() === reportID)) | |
); | |
function isThreadParentMessage(reportAction = {}, reportID) { | |
const {childType, childVisibleActionCount = 0, childReportID} = reportAction; | |
return childType === CONST.REPORT.TYPE.CHAT && (childVisibleActionCount > 0 || String(childReportID) === reportID); |
NAB: Let's improve the code readability.
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 for your suggestions; I've just applied the recommended changes.
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.
cc @Nodebrute Thanks for the update , let's make sure to resolve other comments as well.
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.
Looks good to me and tests well.
🎀 👀 🎀 C+ reviewed
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.
Few comments and small requested changes 🙏
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!
Small feedback for you, @Nodebrute :
- Thanks SO much for following through on the long proposal process & getting this PR up quickly & responding to feedback quickly 👍 👍
- I'd recommend making a strong PR title that explains more succinctly its purpose
- When you finish dealing with any comment (from me or @fedirjh ), it would be great if you could resolve it yourself so we don't go back and have to question if each comment was addressed or not. If you have more questions about any comment or want our feedback on your solution related to any comment, feel free to keep it open & tag us again so we know to look at it again
Thanks again!!
✋ 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/Beamanator in version: 1.3.68-0 🚀
|
🚀 Deployed to production by https://github.com/Julesssss in version: 1.3.68-17 🚀
|
Details
Fixed Issues
$ #23139
$ #23139 (comment)
Tests
Test 2
Offline tests
same as above
QA Steps
Test 2
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
Untitled.3.mp4
Mobile Web - Chrome
Untitled.2.mp4
Mobile Web - Safari
Untitled.4.mp4
Desktop
Untitled.1.mp4
iOS
Untitled.5.mp4
Android
Untitled.7.mp4