-
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 bugs surrounding report name when deleting first thread comment #23514
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -897,7 +897,7 @@ function deleteReportComment(reportID, reportAction) { | |||||
lastMessageText: '', | ||||||
lastVisibleActionCreated: '', | ||||||
}; | ||||||
if (reportAction.reportActionID && reportAction.childVisibleActionCount > 0) { | ||||||
if (reportAction.reportActionID && reportAction.childVisibleActionCount === 0) { | ||||||
optimisticReport = { | ||||||
lastMessageTranslationKey: '', | ||||||
lastMessageText: '', | ||||||
|
@@ -963,6 +963,16 @@ function deleteReportComment(reportID, reportAction) { | |||||
optimisticData.push(optimisticParentReportData); | ||||||
} | ||||||
|
||||||
// If the reportID doesn't equal the originalReportID then this is the first comment on a thread report and we need to trigger | ||||||
// some sort of update to let the LHN know that the parentReportAction is now deleted. | ||||||
if (reportID !== originalReportID) { | ||||||
marcaaron marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
optimisticData.push({ | ||||||
onyxMethod: Onyx.METHOD.MERGE, | ||||||
key: `${ONYXKEYS.COLLECTION.REPORT}${reportID}`, | ||||||
value: {isParentReportActionDeleted: true}, | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. NAB but just an idea to make it more in line with the comment
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ah, yes, I prefer this. It solves my concern about people trying to use |
||||||
}); | ||||||
} | ||||||
|
||||||
const parameters = { | ||||||
reportID: originalReportID, | ||||||
reportActionID, | ||||||
|
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.
Do we need to check
reportAction.reportActionID
here?Doesn't this imply it's truthy? If it's still needed, can it be replaced with
if (reportActionID && ...
?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.
That's a good point. If it's not defined then something is wrong because we are about to save an object with a key of
undefined
. I think this was probably just overly cautious programming.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.
If there is a reason it should have been documented better 🤷♂️