Skip to content
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

Merged
merged 4 commits into from
Jul 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.childVisibleActionCount === 0) {
optimisticReport = {
lastMessageTranslationKey: '',
lastMessageText: '',
Expand Down Expand Up @@ -963,6 +963,16 @@ function deleteReportComment(reportID, reportAction) {
optimisticData.push(optimisticParentReportData);
}

// Check to see if the report action we are deleting is the first comment on a thread report. In this case, we need to trigger
// an update to let the LHN know that the parentReportAction is now deleted.
if (ReportUtils.isThreadFirstChat(reportAction, reportID)) {
optimisticData.push({
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT}${reportID}`,
value: {updateReportInLHN: true},
});
}

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