-
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 reply in thread shows for thread parent #51721
Fix reply in thread shows for thread parent #51721
Conversation
@allgandalf 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] |
if (!isEmptyObject(linkedReport) && (isMoneyRequestReport(linkedReport) || isInvoiceReport(linkedReport))) { | ||
return canDeleteTransaction(linkedReport); | ||
if (!isEmptyObject(report) && (isMoneyRequestReport(report) || isInvoiceReport(report))) { | ||
return canDeleteTransaction(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.
canDeleteReportAction
is only being used in ContextMenuActions.
const linkedReport = isThreadFirstChat(reportAction, reportID) ? getReportOrDraftReport(report?.parentReportID) : report;
This logic was added in #40287 because the reportID of the thread parent message is the currently view report. But because the reportID now contains the reportID of the report action, we don't need this anymore.
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.
makes sense to me
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.
Makes sense, but can we please write a manual test that will verify this?
This will be the last usage of Lines 7205 to 7211 in a739661
|
Reviewer Checklist
Screenshots/VideosAndroid: NativeScreen.Recording.2024-11-08.at.3.35.56.PM.movAndroid: mWeb ChromeScreen.Recording.2024-11-08.at.3.34.40.PM.moviOS: NativeScreen.Recording.2024-11-08.at.3.43.00.PM.moviOS: mWeb SafariScreen.Recording.2024-11-08.at.3.44.34.PM.movMacOS: Chrome / SafariScreen.Recording.2024-11-08.at.1.40.12.PM.movMacOS: DesktopScreen.Recording.2024-11-08.at.3.22.21.PM.mov |
@bernhardoj apologies for the delayed review, can you please merge main ? |
Done |
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.
Changes LGTM, this works well in offline mode 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.
After seeing the code, I'm starting to think the proposal wasn't the best idea. I probably should have thought about it more carefully. I mostly have a lot of questions. The main question is, shouldn't we be able to determine if an action is a parent report action for a thread? If so, can we tweak the existing function to work reliably? Why or why not?
if (!isEmptyObject(linkedReport) && (isMoneyRequestReport(linkedReport) || isInvoiceReport(linkedReport))) { | ||
return canDeleteTransaction(linkedReport); | ||
if (!isEmptyObject(report) && (isMoneyRequestReport(report) || isInvoiceReport(report))) { | ||
return canDeleteTransaction(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.
Makes sense, but can we please write a manual test that will verify this?
src/pages/home/report/ContextMenu/BaseReportActionContextMenu.tsx
Outdated
Show resolved
Hide resolved
We can't tell if it's the thread first chat from the action alone. As seen in the function, we compare the action Lines 1594 to 1596 in c75b1bc
What makes an action a thread first chat action? From the logic above, an action is a thread-first chat action if the action So, in my proposal, I think the better way is to mark an action as thread first chat in |
Note @neil-marcellini is OoO this week, I will raise the issue on slack to see if we should hold or add another internal reviewer :) |
I think this is low priority so we can wait until neil is back |
welcome back @neil-marcellini , would you be able to re-review the PR this week ? |
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.
Ok thanks so much for explaining again. It's a pretty tricky and nuanced issue, and I agree with your reasoning that it's fragile and maybe confusing to pass a reportID into such a function. I don't like that we have to do so much parameter passing, but I guess it's the best way for now. There are still some outstanding issues to resolve but they should be pretty easy.
@neil-marcellini done |
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.
Good to go, thanks!
✋ 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/neil-marcellini in version: 9.0.66-0 🚀
|
🚀 Deployed to production by https://github.com/mountiny in version: 9.0.66-8 🚀
|
Explanation of Change
A reply in the thread still shows for the parent thread message. This PR fixes it by passing isThreadFirstChat as param for every thread parent message.
Fixed Issues
$ #50262
PROPOSAL: #50262 (comment)
Tests
Same as QA Steps
Offline tests
Same as QA Steps
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.mp4
Android: mWeb Chrome
android.mweb.mp4
iOS: Native
ios.mp4
iOS: mWeb Safari
ios.mweb.mp4
MacOS: Chrome / Safari
web.mp4
MacOS: Desktop
desktop.mp4