Skip to content

Commit

Permalink
fix: Show story map title in error message
Browse files Browse the repository at this point in the history
  • Loading branch information
josebui committed Oct 5, 2023
1 parent 887844b commit 975e42a
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 15 deletions.
19 changes: 9 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"slate-history": "^0.93.0",
"slate-hyperscript": "^0.77.0",
"slate-react": "^0.99.0",
"terraso-client-shared": "github:techmatters/terraso-client-shared#a0e3a5e",
"terraso-client-shared": "github:techmatters/terraso-client-shared#b86117e3735b2d8b2f85ffdb68547eb9738b9f77",
"use-debounce": "^9.0.4",
"uuid": "^9.0.0",
"web-vitals": "^3.4.0",
Expand Down
2 changes: 1 addition & 1 deletion src/localization/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -1015,7 +1015,7 @@
"approved_membership": "You have been added to “{{storyMapTitle}}”",
"approve_invite_success": "You have been added to “{{storyMapTitle}}”",
"approveMembership.update_not_allowed": "Unable to accept Story Map invitation",
"approveMembership.update_not_allowed_permissions_validation": "You can't accept the invitation for the Story Map “{{storyMapTitle}}.” You must be logged in using the email address shown in the invitation.",
"approveMembership.update_not_allowed_permissions_validation": "You can't accept the invitation for the Story Map “{{storyMapTitle}}”. You must be logged in using the email address shown in the invitation.",
"invite_document_title": "Story Map Invite"
},
"site": {
Expand Down
2 changes: 1 addition & 1 deletion src/localization/locales/es-ES.json
Original file line number Diff line number Diff line change
Expand Up @@ -1022,7 +1022,7 @@
"approved_membership": "Te han agregado a “{{storyMapTitle}}”",
"approve_invite_success": "Te han agregado a “{{storyMapTitle}}”",
"approveMembership.update_not_allowed": "No se puede aceptar la invitación de Story Map",
"approveMembership.update_not_allowed_permissions_validation": "No puedes aceptar esta invitación de Story Map. Debes iniciar sesión con la dirección de correo electrónico que se muestra en la invitación.",
"approveMembership.update_not_allowed_permissions_validation": "No puedes aceptar la invitación para el Story Map “{{storyMapTitle}}”. Debes iniciar sesión con la dirección de correo electrónico que se muestra en la invitación.",
"invite_document_title": "Invitación a Story Map"
},
"site": {
Expand Down
5 changes: 4 additions & 1 deletion src/storyMap/components/StoryMapInvite.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,10 @@ const StoryMapInvite = () => {
<PageContainer>
{error?.parsedErrors.map((error, index) => (
<Alert key={index} severity={error.severity}>
{t(error.content, error.params)}
{t(error.content, {
...error.params,
storyMapTitle: error.params?.response?.storyMap?.title,
})}
</Alert>
))}
</PageContainer>
Expand Down
9 changes: 8 additions & 1 deletion src/storyMap/components/StoryMapInvite.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,21 @@ test('StoryMapInvite: Different user token', async () => {
mockTerrasoAPIrequestGraphQL({
'mutation approveMembershipToken': Promise.reject({
content: 'update_not_allowed_permissions_validation',
params: {
response: {
storyMap: {
title: 'Story Map title',
},
},
},
}),
});

await setup();

expect(
within(screen.getByRole('alert')).getByText(
/You can't accept this Story Map invitation. You must be logged in using the email address shown in the invitation/i
/You can't accept the invitation for the Story Map “Story Map title”. You must be logged in using the email address shown in the invitation./i
)
).toBeInTheDocument();

Expand Down

0 comments on commit 975e42a

Please sign in to comment.