Skip to content

Commit 97e5f43

Browse files
committed
fix: ensure participant email is preserved after chat creation failure
1 parent 2b07d49 commit 97e5f43

1 file changed

Lines changed: 14 additions & 15 deletions

File tree

src/libs/actions/Report/index.ts

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1909,25 +1909,24 @@ function openReport(params: OpenReportActionParams) {
19091909
});
19101910
}
19111911

1912-
if (shouldKeepPersonalDetailsOnFailure) {
1913-
failureData.push(
1914-
{
1915-
onyxMethod: Onyx.METHOD.MERGE,
1916-
key: `${ONYXKEYS.COLLECTION.REPORT}${reportID}`,
1917-
value: {
1918-
errorFields: {
1919-
createChat: getMicroSecondOnyxErrorWithTranslationKey('report.genericCreateReportFailureMessage'),
1920-
},
1912+
if (!isNewThread) {
1913+
failureData.push({
1914+
onyxMethod: Onyx.METHOD.MERGE,
1915+
key: `${ONYXKEYS.COLLECTION.REPORT}${reportID}`,
1916+
value: {
1917+
errorFields: {
1918+
createChat: getMicroSecondOnyxErrorWithTranslationKey('report.genericCreateReportFailureMessage'),
19211919
},
19221920
},
1923-
{
1924-
onyxMethod: Onyx.METHOD.MERGE,
1925-
key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`,
1926-
value: {[optimisticCreatedAction.reportActionID]: {pendingAction: null}},
1927-
},
1928-
);
1921+
});
19291922
}
19301923

1924+
failureData.push({
1925+
onyxMethod: Onyx.METHOD.MERGE,
1926+
key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`,
1927+
value: {[optimisticCreatedAction.reportActionID]: {pendingAction: null}},
1928+
});
1929+
19311930
// Add the createdReportActionID parameter to the API call
19321931
parameters.createdReportActionID = optimisticCreatedAction.reportActionID;
19331932

0 commit comments

Comments
 (0)