Skip to content

Commit 94bc056

Browse files
authored
Merge pull request Expensify#74063 from daledah/fix/72517
fix: export option not showing for admins
2 parents ed859cc + 7ced052 commit 94bc056

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/libs/ReportPrimaryActionUtils.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,10 @@ function isExportAction(report: Report, policy?: Policy, reportActions?: ReportA
195195
return false;
196196
}
197197

198+
const isAdmin = policy?.role === CONST.POLICY.ROLE.ADMIN;
199+
198200
const isReportExporter = isPreferredExporter(policy);
199-
if (!isReportExporter) {
201+
if (!isReportExporter && !isAdmin) {
200202
return false;
201203
}
202204

src/libs/actions/Policy/Member.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -321,9 +321,8 @@ function resetAccountingPreferredExporter(policyID: string, loginList: string[])
321321
if (!adminLoginList.length) {
322322
return {optimisticData, successData, failureData};
323323
}
324-
325324
for (const connection of connections) {
326-
const exporter = policy?.connections?.[connection]?.config.export.exporter;
325+
const exporter = policy?.connections?.[connection]?.config?.export?.exporter;
327326
if (!exporter || !adminLoginList.includes(exporter)) {
328327
continue;
329328
}
@@ -357,7 +356,7 @@ function resetAccountingPreferredExporter(policyID: string, loginList: string[])
357356
connections: {
358357
[connection]: {
359358
config: {
360-
export: {exporter: policy?.connections?.[connection]?.config.export.exporter},
359+
export: {exporter},
361360
pendingFields: {[pendingFieldKey]: null},
362361
},
363362
},
@@ -366,7 +365,7 @@ function resetAccountingPreferredExporter(policyID: string, loginList: string[])
366365
});
367366
}
368367

369-
const exporter = policy?.connections?.netsuite?.options.config.exporter;
368+
const exporter = policy?.connections?.netsuite?.options?.config?.exporter;
370369
if (exporter && adminLoginList.includes(exporter)) {
371370
optimisticData.push({
372371
onyxMethod: Onyx.METHOD.MERGE,
@@ -385,7 +384,7 @@ function resetAccountingPreferredExporter(policyID: string, loginList: string[])
385384
failureData.push({
386385
onyxMethod: Onyx.METHOD.MERGE,
387386
key: policyKey,
388-
value: {connections: {netsuite: {options: {config: {exporter: policy?.connections?.netsuite?.options.config.exporter, pendingFields: {exporter: null}}}}}},
387+
value: {connections: {netsuite: {options: {config: {exporter, pendingFields: {exporter: null}}}}}},
389388
});
390389
}
391390

0 commit comments

Comments
 (0)