Skip to content
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
4 changes: 2 additions & 2 deletions src/libs/actions/Policy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1562,7 +1562,7 @@ function createWorkspaceFromIOUPayment(iouReport: Report | EmptyObject): string
const policyID = generatePolicyID();
const workspaceName = generateDefaultWorkspaceName(sessionEmail);
const employeeAccountID = iouReport.ownerAccountID;
const employeeEmail = iouReport.ownerEmail;
const employeeEmail = iouReport.ownerEmail ?? '';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const employeeEmail = iouReport.ownerEmail ?? '';
const employeeEmail = allPersonalDetails?.[employeeAccountID?.toString() ?? '']?.login;

Maybe use this instead.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually think that we don't need to have an email here, we can just put it empty and it will still work
employeeEmail = ''
but I guess it would look weird. But instead of retrieving the email from the personal detail, I just use null-coalescing to keep it simple.

const {customUnits, customUnitID, customUnitRateID} = buildOptimisticCustomUnits();
const oldPersonalPolicyID = iouReport.policyID;
const iouReportID = iouReport.reportID;
Expand All @@ -1582,7 +1582,7 @@ function createWorkspaceFromIOUPayment(iouReport: Report | EmptyObject): string
expenseCreatedReportActionID: workspaceChatCreatedReportActionID,
} = ReportUtils.buildOptimisticWorkspaceChats(policyID, workspaceName);

if (!employeeAccountID || !employeeEmail) {
if (!employeeAccountID) {
return;
}

Expand Down