Skip to content

Commit

Permalink
Fix required fields check on Bulk registration CSV upload, fixes #29 (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
aine-etke authored Sep 17, 2024
1 parent 332e98a commit 66c7065
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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_

Expand Down
6 changes: 5 additions & 1 deletion src/components/ImportFeature.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,11 @@ const FilePicker = () => {

const verifyCsv = ({ data, meta, errors }: ParseResult<ImportLine>, { 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] }));
Expand Down

0 comments on commit 66c7065

Please sign in to comment.