From 2f087bd009b70e554c137b5b12805951c89af1bb Mon Sep 17 00:00:00 2001 From: olewandowski1 Date: Mon, 24 Jul 2023 10:55:20 +0200 Subject: [PATCH] CM-134: use id in mutation labels to avoid mutation errors --- src/components/GroupIndividualSearcher.js | 3 +-- src/components/IndividualSearcher.js | 3 +-- src/pages/IndividualPage.js | 6 ++---- src/translations/en.json | 6 +++--- 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/components/GroupIndividualSearcher.js b/src/components/GroupIndividualSearcher.js index 8b90e5c..9694d4f 100644 --- a/src/components/GroupIndividualSearcher.js +++ b/src/components/GroupIndividualSearcher.js @@ -151,8 +151,7 @@ function GroupIndividualSearcher({ updateGroupIndividual( editedGroupIndividual, formatMessageWithValues(intl, 'individual', 'groupIndividual.update.mutationLabel', { - firstName: editedGroupIndividual.individual.firstName, - lastName: editedGroupIndividual.individual.lastName, + id: editedGroupIndividual?.individual?.id, }), ); } diff --git a/src/components/IndividualSearcher.js b/src/components/IndividualSearcher.js index 208cb6a..720356e 100644 --- a/src/components/IndividualSearcher.js +++ b/src/components/IndividualSearcher.js @@ -86,8 +86,7 @@ function IndividualSearcher({ deleteIndividual( individualToDelete, formatMessageWithValues(intl, 'individual', 'individual.delete.mutationLabel', { - firstName: individualToDelete.firstName, - lastName: individualToDelete.lastName, + id: individualToDelete?.id, }), ); setDeletedIndividualUuids([...deletedIndividualUuids, individualToDelete.id]); diff --git a/src/pages/IndividualPage.js b/src/pages/IndividualPage.js index 03dc141..7880a7a 100644 --- a/src/pages/IndividualPage.js +++ b/src/pages/IndividualPage.js @@ -106,8 +106,7 @@ function IndividualPage({ updateIndividual( editedIndividual, formatMessageWithValues(intl, 'individual', 'individual.update.mutationLabel', { - firstName: individual?.firstName, - lastName: individual?.lastName, + id: individual?.id, }), ); }; @@ -115,8 +114,7 @@ function IndividualPage({ const deleteIndividualCallback = () => deleteIndividual( individual, formatMessageWithValues(intl, 'individual', 'individual.delete.mutationLabel', { - firstName: individual?.firstName, - lastName: individual?.lastName, + id: individual?.id, }), ); diff --git a/src/translations/en.json b/src/translations/en.json index 09a875a..bae3558 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -25,11 +25,11 @@ "title": "Delete {firstName} {lastName}?", "message": "Deleting data does not mean erasing it from OpenIMIS database. The data will only be deactivated from the viewed list." }, - "mutationLabel": "Delete Individual {firstName} {lastName}" + "mutationLabel": "Delete Individual {id}" }, "update": { "label": "Update Individual", - "mutationLabel":"Update Individual {firstName} {lastName}" + "mutationLabel":"Update Individual {id}" }, "saveButton.tooltip.enabled": "Save changes", "saveButton.tooltip.disabled": "Please fill General Information fields first", @@ -96,7 +96,7 @@ }, "update": { "label": "Update Individual", - "mutationLabel":"Update Individual {firstName} {lastName}" + "mutationLabel":"Update Individual {id}" }, "groupIndividualRolePicker.HEAD": "HEAD", "groupIndividualRolePicker.RECIPIENT": "RECIPIENT",