Skip to content

Commit

Permalink
Fix bugs surrounding report name when deleting first thread comment
Browse files Browse the repository at this point in the history
  • Loading branch information
marcaaron committed Jul 24, 2023
1 parent c3fd1ea commit 93e5812
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/libs/actions/Report.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: '',
Expand Down Expand Up @@ -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) {
optimisticData.push({
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT}${reportID}`,
value: {isParentReportActionDeleted: true},
});
}

const parameters = {
reportID: originalReportID,
reportActionID,
Expand Down

0 comments on commit 93e5812

Please sign in to comment.