From 66c706532acd57ec54c94dba8511f7ce1da61456 Mon Sep 17 00:00:00 2001 From: Aine <97398200+aine-etke@users.noreply.github.com> Date: Tue, 17 Sep 2024 13:17:07 +0300 Subject: [PATCH] Fix required fields check on Bulk registration CSV upload, fixes #29 (#32) --- README.md | 1 + src/components/ImportFeature.tsx | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index dbfd6c6..a0c6e14 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,7 @@ The following changes are already implemented: * [Put the version into manifest.json](https://github.com/Awesome-Technologies/synapse-admin/issues/507) (CI only) * [Federation page improvements](https://github.com/Awesome-Technologies/synapse-admin/pull/583) (using theme colors) * [Add UI option to block deleted rooms from being rejoined](https://github.com/etkecc/synapse-admin/pull/26) +* [Fix required fields check on Bulk registration CSV upload](https://github.com/etkecc/synapse-admin/pull/32) _the list will be updated as new changes are added_ diff --git a/src/components/ImportFeature.tsx b/src/components/ImportFeature.tsx index 062af3d..ebd9b0f 100644 --- a/src/components/ImportFeature.tsx +++ b/src/components/ImportFeature.tsx @@ -121,7 +121,11 @@ const FilePicker = () => { const verifyCsv = ({ data, meta, errors }: ParseResult, { setValues, setStats, setError }) => { /* First, verify the presence of required fields */ - const missingFields = expectedFields.filter(eF => meta.fields?.find(mF => eF === mF)); + const missingFields = expectedFields.filter(eF => { + const result = meta.fields?.find(mF => eF === mF); + if (result === undefined) { return eF; } // missing field + return undefined; // field found + }); if (missingFields.length > 0) { setError(translate("import_users.error.required_field", { field: missingFields[0] }));